mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-20 14:44:20 +01:00
monitor: fix flakyness
Sometimes a channels funding allocation was not yet readable via listpeers which is why this plugin test was flaky. Also makes use of funding_msat instead of deprecated fields.
This commit is contained in:
@@ -41,11 +41,17 @@ def monitor(plugin):
|
||||
else:
|
||||
states[state] = 1
|
||||
connected = 'connected' if p['connected'] else 'disconnected'
|
||||
funding = c['funding_allocation_msat']
|
||||
fees = "unknown onchain fees"
|
||||
funding = c.get('funding_msat', None)
|
||||
if funding is not None:
|
||||
our_funding = funding[nid]
|
||||
fees = "our fees"
|
||||
their_funding = funding[p['id']]
|
||||
if int(our_funding) == 0:
|
||||
fees = "their fees"
|
||||
fees = "their onchain fees"
|
||||
elif int(their_funding) == 0:
|
||||
fees = "our onchain fees"
|
||||
else:
|
||||
fees = "shared onchain fees"
|
||||
total = int(c['total_msat'])
|
||||
ours = int(c['our_reserve_msat']) + int(c['spendable_msat'])
|
||||
our_fraction = '{:4.2f}% owned by us'.format(ours * 100 / total)
|
||||
|
||||
Reference in New Issue
Block a user