From fe07f0d578907578de726196c67f7df2816a5c72 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Fri, 3 Feb 2023 13:28:19 +0100 Subject: [PATCH] summary: fix cli upstream changes on listpeerchannels --- summary/summary.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/summary/summary.py b/summary/summary.py index 0f3d5de..0464121 100755 --- a/summary/summary.py +++ b/summary/summary.py @@ -100,7 +100,7 @@ def summary(plugin, exclude=''): reply = {} info = plugin.rpc.getinfo() funds = plugin.rpc.listfunds() - peers = plugin.rpc.listpeers() + peers = plugin.rpc.listpeers()['peers'] # Make it stand out if we're not on mainnet. if info['network'] != 'bitcoin': @@ -123,11 +123,16 @@ def summary(plugin, exclude=''): reply['num_channels'] = 0 reply['num_connected'] = 0 reply['num_gossipers'] = 0 - for p in peers['peers']: + for p in peers: pid = p['id'] + channels = [] + if 'channels' in p: + channels = p['channels'] + elif 'num_channels' in p and p['num_channels'] > 0: + channels = plugin.rpc.listpeerchannels(pid)['channels'] addpeer(plugin, p) active_channel = False - for c in p['channels']: + for c in channels: if c['state'] != 'CHANNELD_NORMAL': continue active_channel = True