From c06a9ccb9cd1557cd0ef6698aa7d44b097c8232f Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 4 Jun 2022 11:17:21 +0200 Subject: [PATCH] num_sats_can_receive: bucket channels that we have with the same node --- electrum/lnworker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index f61a3a460..038e31742 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -2166,9 +2166,12 @@ class LNWallet(LNWorker): else: delta_msat = 0 return chan.available_to_spend(REMOTE) + delta_msat + # bucket channels that we have with the same node + can_recv_dict = defaultdict(int) with self.lock: - recv_channels = self.get_channels_for_receiving() - recv_chan_msats = [recv_capacity(chan) for chan in recv_channels] + for c in self.get_channels_for_receiving(): + can_recv_dict[c.node_id] += recv_capacity(c) + recv_chan_msats = list(can_recv_dict.values()) if not recv_chan_msats: return Decimal(0) can_receive_msat = max(