common: allow current_feerate under 253 in marginal_feerate().
What changed, and why it matters
This small code change removes a hard crash (assertion) that would occur if a future version of the software allowed Bitcoin feerates below 253 satoshis per kiloweight. Instead of crashing, the function now quietly raises such low feerates up to the minimum. The change is framed by the author as a future-proofing measure, not a fix for an active security bug.
Treat as low-risk hardening. Review whether any caller can currently pass a feerate below 253, and ensure the clamp behavior is safe for fee-bumping logic. No urgent action required absent an independent report showing the assertion was reachable.
Security signals we found
Assertion removal in feerate handling
Defensive clamping of out-of-range feerate
Author states current spec does not allow the low-feerate case
No explicit security relevance disclosed by vendor
Evidence from the diff
In common/fee_states.c, marginal_feerate() previously asserted that current_feerate >= minfeerate (253). The patch replaces the assertion with a clamp: if current_feerate is below the minimum, it is set to minfeerate. This prevents an abort in builds where assertions are enabled, should a sub-253 feerate ever be passed in. The author explicitly notes this is not currently allowed by spec. There is no direct evidence in the commit of an exploitable path to trigger the assertion today.
Changed components
common/fee_states.cmarginal_feerate()Inspect captured patch +3 / −1
diff --git a/common/fee_states.c b/common/fee_states.c
index 3d1a8976..1626ea82 100644
--- a/common/fee_states.c
+++ b/common/fee_states.c
@@ -172,7 +172,9 @@ u32 marginal_feerate(u32 current_feerate)
if (current_feerate == 0)
return 0;
#endif
- assert(current_feerate >= minfeerate);
+ /* This could happen in future if we celebrate sub-sat summer! */
+ if (current_feerate < minfeerate)
+ current_feerate = minfeerate;
if (current_feerate > maxfeerate)
return current_feerate * 1.1;
Why this scored 21/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.