From a829d87c6b937d87e45953b3df60216bbb9c3213 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Thu, 18 Nov 2021 13:37:33 +0100 Subject: [PATCH] drain: fix KeyError short_channel_id on opening channels --- drain/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drain/utils.py b/drain/utils.py index 082956d..b7cb189 100644 --- a/drain/utils.py +++ b/drain/utils.py @@ -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