Skip to content

Commit b3223ab

Browse files
authored
Merge pull request #3147 from TheBlueMatt/2024-06-feerate-overflow
Handle feerates of `u32::MAX` without overflowing
2 parents cb08498 + e8bc0c9 commit b3223ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
27682768
feerate_per_kw = cmp::max(feerate_per_kw, feerate);
27692769
}
27702770
let feerate_plus_quarter = feerate_per_kw.checked_mul(1250).map(|v| v / 1000);
2771-
cmp::max(feerate_per_kw + 2530, feerate_plus_quarter.unwrap_or(u32::max_value()))
2771+
cmp::max(feerate_per_kw.saturating_add(2530), feerate_plus_quarter.unwrap_or(u32::MAX))
27722772
}
27732773

27742774
/// Get forwarding information for the counterparty.

0 commit comments

Comments
 (0)