1
0

num_sats_can_receive: bucket channels that we have with the same node

This commit is contained in:
ThomasV
2022-06-04 11:17:21 +02:00
parent 450476dcb6
commit c06a9ccb9c

View File

@@ -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(