Skip to content

Commit

Permalink
Merge pull request lightningdevkit#3147 from TheBlueMatt/2024-06-feer…
Browse files Browse the repository at this point in the history
…ate-overflow

Handle feerates of `u32::MAX` without overflowing
  • Loading branch information
tnull authored Jun 27, 2024
2 parents cb08498 + e8bc0c9 commit b3223ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2768,7 +2768,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
feerate_per_kw = cmp::max(feerate_per_kw, feerate);
}
let feerate_plus_quarter = feerate_per_kw.checked_mul(1250).map(|v| v / 1000);
cmp::max(feerate_per_kw + 2530, feerate_plus_quarter.unwrap_or(u32::max_value()))
cmp::max(feerate_per_kw.saturating_add(2530), feerate_plus_quarter.unwrap_or(u32::MAX))
}

/// Get forwarding information for the counterparty.
Expand Down

0 comments on commit b3223ab

Please sign in to comment.