1
0

improve suggest_peers; add htlcs to list_channels.

This commit is contained in:
ThomasV
2018-10-17 11:56:34 +02:00
parent f8894d467f
commit 87cc312d1e

View File

@@ -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(),