Skip to content

Commit

Permalink
Also ensure post-estimation fee rate tweaks can never undeflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Jan 15, 2025
1 parent fe61011 commit dd0fc39
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/fee_estimator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ pub(crate) fn apply_post_estimation_adjustments(
ConfirmationTarget::Lightning(
LdkConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
) => {
let slightly_less_than_background = estimated_rate.to_sat_per_kwu() - 250;
let slightly_less_than_background = estimated_rate
.to_sat_per_kwu()
.saturating_sub(250)
.max(FEERATE_FLOOR_SATS_PER_KW as u64);
FeeRate::from_sat_per_kwu(slightly_less_than_background)
},
_ => estimated_rate,
Expand Down

0 comments on commit dd0fc39

Please sign in to comment.