1
0

lnchannel: available_to_spend constrain max amount to channel max_htlc_value_in_flight_msat

This commit is contained in:
Sander van Grieken
2025-05-14 11:35:32 +02:00
committed by ThomasV
parent 25c53ec3a5
commit 7f621d29b5

View File

@@ -1540,6 +1540,12 @@ class Channel(AbstractChannel):
consider_ctx(ctx_owner=sender, is_htlc_dust=False),
),
)
ctn = self.get_next_ctn(receiver)
current_htlc_sum = htlcsum(self.hm.htlcs_by_direction(receiver, direction=RECEIVED, ctn=ctn).values())
remaining_max_inflight = self.config[receiver].max_htlc_value_in_flight_msat - current_htlc_sum
max_send_msat = min(max_send_msat, remaining_max_inflight)
max_send_msat = max(max_send_msat, 0)
return max_send_msat