Browse Source

improve suggest_peers; add htlcs to list_channels.

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
87cc312d1e
  1. 5
      electrum/lnworker.py

5
electrum/lnworker.py

@ -97,10 +97,10 @@ class LNWorker(PrintError):
def suggest_peer(self): def suggest_peer(self):
for node_id, peer in self.peers.items(): for node_id, peer in self.peers.items():
if len(peer.channels) > 0:
continue
if not(peer.initialized.done()): if not(peer.initialized.done()):
continue continue
if not all([chan.get_state() in ['CLOSED'] for chan in peer.channels.values()]):
continue
return node_id return node_id
def channels_for_peer(self, node_id): def channels_for_peer(self, node_id):
@ -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 # 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(): for channel_id, chan in self.channels.items():
yield { yield {
'htlcs': chan.log[LOCAL],
'channel_id': bh2u(chan.short_channel_id), 'channel_id': bh2u(chan.short_channel_id),
'channel_point': chan.funding_outpoint.to_str(), 'channel_point': chan.funding_outpoint.to_str(),
'state': chan.get_state(), 'state': chan.get_state(),

Loading…
Cancel
Save