Skip to content

Commit 7490981

Browse files
committed
Check htlc_maximum_msat and switch limit
As our outbound channel liquidity might already be limited by the `htlc_maximum_msat` which is considered during route finding, it doesn't make sense to further restrict the liquidity for payment probes as sending probes wouldn't necessarily cut into the liquidity accounted for in `next_outbound_htlc_limit_msat`. We therefore detect if we're limited by `htlc_maximum_msat`, and if so, we choose to use our current outbound capacity as the basis for our calculation.
1 parent f80f4b4 commit 7490981

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3537,7 +3537,15 @@ where
35373537
let used_liquidity =
35383538
used_liquidity_map.entry(first_path_hop.short_channel_id).or_insert(0);
35393539

3540-
if first_hop.next_outbound_htlc_limit_msat
3540+
// If we're already limited through `htlc_maximum_msat`, we use the available outbound capacity
3541+
// to calculate the liquidity limit.
3542+
let relevant_limit = if Some(first_hop.next_outbound_htlc_limit_msat) == first_hop.counterparty.outbound_htlc_maximum_msat {
3543+
first_hop.outbound_capacity_msat
3544+
} else {
3545+
first_hop.next_outbound_htlc_limit_msat
3546+
};
3547+
3548+
if relevant_limit
35413549
< (*used_liquidity + path_value)
35423550
* self.default_configuration.preflight_probing_liquidity_limit_multiplier
35433551
{

0 commit comments

Comments
 (0)