diff --git a/summary/README.md b/summary/README.md index a5f855f..50ab3f6 100644 --- a/summary/README.md +++ b/summary/README.md @@ -22,7 +22,7 @@ num_utxos=5 utxo_amount=1.20119332000btc (USD $4473.84) num_channels=29 num_connected=2 -num_gossipers=29 +num_gossipers=1 avail_out=0.27095103btc (USD $1009.16) avail_in=2.05851379btc (USD $7666.93) channels_key=P=private O=offline diff --git a/summary/summary.py b/summary/summary.py index f167e1f..0b1c877 100755 --- a/summary/summary.py +++ b/summary/summary.py @@ -78,14 +78,15 @@ def summary(plugin): chans = [] reply['num_channels'] = 0 reply['num_connected'] = 0 - reply['num_gossipers'] = info['num_peers'] + reply['num_gossipers'] = 0 for p in peers['peers']: + active_channel = False for c in p['channels']: if c['state'] != 'CHANNELD_NORMAL': continue + active_channel = True if p['connected']: reply['num_connected'] += 1 - reply['num_gossipers'] -= 1 if c['our_reserve_msat'] < c['to_us_msat']: to_us = c['to_us_msat'] - c['our_reserve_msat'] else: @@ -102,6 +103,9 @@ def summary(plugin): reply['num_channels'] += 1 chans.append((c['total_msat'], to_us, to_them, p['id'], c['private'], p['connected'])) + if not active_channel and p['connected']: + reply['num_gossipers'] += 1 + reply['avail_out'] = avail_out.to_btc_str() reply['avail_in'] = avail_in.to_btc_str()