Skip to content

Commit 8b5cd47

Browse files
committed
f til about clamp
1 parent 60801d9 commit 8b5cd47

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,10 @@ pub(crate) fn set_max_path_length(
333333
.saturating_add(PAYLOAD_HMAC_LEN);
334334

335335
const OVERPAY_ESTIMATE_MULTIPLER: u64 = 3;
336-
let final_value_msat_with_overpay_buffer = core::cmp::min(
337-
0x1000_0000,
338-
core::cmp::max(
339-
route_params.final_value_msat.saturating_mul(OVERPAY_ESTIMATE_MULTIPLER),
340-
MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY,
341-
),
342-
);
336+
let final_value_msat_with_overpay_buffer = route_params
337+
.final_value_msat
338+
.saturating_mul(OVERPAY_ESTIMATE_MULTIPLER)
339+
.clamp(MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY, 0x1000_0000);
343340

344341
let blinded_tail_opt = route_params
345342
.payment_params

0 commit comments

Comments
 (0)