timprove suggest_peers; add htlcs to list_channels. - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit 87cc312d1eb89f03d12d6280554eb6b5e4dcb5e3
 (DIR) parent f8894d467fea17dff44b9306072fe3697cdbb603
 (HTM) Author: ThomasV <thomasv@electrum.org>
       Date:   Wed, 17 Oct 2018 11:56:34 +0200
       
       improve suggest_peers; add htlcs to list_channels.
       
       Diffstat:
         M electrum/lnworker.py                |       5 +++--
       
       1 file changed, 3 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/electrum/lnworker.py b/electrum/lnworker.py
       t@@ -97,10 +97,10 @@ class LNWorker(PrintError):
        
            def suggest_peer(self):
                for node_id, peer in self.peers.items():
       -            if len(peer.channels) > 0:
       -                continue
                    if not(peer.initialized.done()):
                        continue
       +            if not all([chan.get_state() in ['CLOSED'] for chan in peer.channels.values()]):
       +                continue
                    return node_id
        
            def channels_for_peer(self, node_id):
       t@@ -373,6 +373,7 @@ class LNWorker(PrintError):
                    # we output the funding_outpoint instead of the channel_id because lnd uses channel_point (funding outpoint) to identify channels
                    for channel_id, chan in self.channels.items():
                        yield {
       +                    'htlcs': chan.log[LOCAL],
                            'channel_id': bh2u(chan.short_channel_id),
                            'channel_point': chan.funding_outpoint.to_str(),
                            'state': chan.get_state(),