Skip to content

Commit 7919dbf

Browse files
committed
Hop Increment of HTLC Minimum is now calculated against aggregate. Breaking out if it maxes out on u64 upon checked_add.
1 parent ab29653 commit 7919dbf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/routing/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
946946
.map_or(None, |inc| inc.checked_add(aggregate_next_hops_fee_msat));
947947
aggregate_next_hops_fee_msat = if let Some(val) = hops_fee { val } else { break; };
948948

949-
let hop_htlc_minimum_msat_inc = compute_fees(hop_htlc_minimum_msat, hop.fees).unwrap_or(u64::max_value());
949+
let hop_htlc_minimum_msat_inc = if let Some(val) = compute_fees(aggregate_next_hops_path_htlc_minimum_msat, hop.fees) { val } else { break; };
950950
let hops_path_htlc_minimum = aggregate_next_hops_path_htlc_minimum_msat
951951
.checked_add(hop_htlc_minimum_msat_inc);
952952
aggregate_next_hops_path_htlc_minimum_msat = if let Some(val) = hops_path_htlc_minimum { cmp::max(hop_htlc_minimum_msat, val) } else { break; };

0 commit comments

Comments
 (0)