Skip to content

Commit 28cebe1

Browse files
committed
Use closest multiple of 40 as offset limit.
1 parent 7474271 commit 28cebe1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lightning/src/routing/router.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,8 @@ where L::Target: Logger {
15761576
let max_path_offset = payment_params.max_total_cltv_expiry_delta
15771577
.checked_sub(path.iter().fold(0, |acc,b| b.as_ref().unwrap().cltv_expiry_delta.max(acc)))
15781578
.unwrap_or(shadow_ctlv_expiry_delta_offset);
1579-
shadow_ctlv_expiry_delta_offset = cmp::min(shadow_ctlv_expiry_delta_offset, max_path_offset);
1579+
shadow_ctlv_expiry_delta_offset = cmp::min(shadow_ctlv_expiry_delta_offset,
1580+
max_path_offset.checked_sub(max_path_offset.wrapping_rem(40)).unwrap_or(max_path_offset));
15801581

15811582
// Add 'shadow' CLTV offset to all hops but the final one
15821583
for h in path {

0 commit comments

Comments
 (0)