mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-24 00:24:19 +01:00
drain: fix KeyError short_channel_id on opening channels
This commit is contained in:
@@ -25,13 +25,13 @@ def wait_for_all_htlcs(nodes):
|
||||
|
||||
# returns our_amount_msat for a given node and scid
|
||||
def get_ours(node, scid):
|
||||
return [c for c in node.rpc.listfunds()['channels'] if c['short_channel_id'] == scid][0]['our_amount_msat']
|
||||
return [c for c in node.rpc.listfunds()['channels'] if c.get('short_channel_id') == scid][0]['our_amount_msat']
|
||||
|
||||
|
||||
# returns their_amount_msat for a given node and scid
|
||||
def get_theirs(node, scid):
|
||||
ours = get_ours(node, scid)
|
||||
total = [c for c in node.rpc.listfunds()['channels'] if c['short_channel_id'] == scid][0]['amount_msat']
|
||||
total = [c for c in node.rpc.listfunds()['channels'] if c.get('short_channel_id') == scid][0]['amount_msat']
|
||||
return total - ours
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user