AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 60 Bitcoin

Don't trim HTLCs when calculating the reserved commit tx fee

Public commit record

What the developer wrote

Authored by Leo Nash

93/100 · Strong
Don't trim HTLCs when calculating the reserved commit tx fee

We previously accounted for HTLC trims at the spiked feerate when
calculating the reserved commitment transaction fees.

This could cause an underestimate of the real current commitment fee at
the current channel feerate. This is because a 2x increase in the
feerate could trim enough HTLCs to result in a smaller commitment
transaction fee.

Also, the previous code only reserved the fee for an exact 2x increase
in the feerate, instead of reserving the fee for any increase in the
feerate between 1x to 2x.

Fixes #4563.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in how the Lightning node calculates the reserve funds it must keep available to pay for a future emergency fee increase. Previously, the node counted how many small HTLC payments would be dropped from the transaction if fees spiked, and used that smaller number to estimate the required reserve. That could lead to an underestimate, because a fee spike could also trim additional HTLCs. The fix now counts non-dust HTLCs at the current feerate and reserves enough for any fee increase between 1x and 2x, not just exactly 2x. The risk is that a node might think it has more spendable balance than it actually can safely afford, potentially leading to a force-close or inability to cover fees during congestion.

Recommended action

Review and merge the patch, then backport to maintained release branches. Operators should upgrade nodes to ensure channel reserve calculations are correct under fee spikes.

Security signals we found

01

Fee-reserve underestimation bug in commitment transaction fee calculation

02

HTLC dust trimming incorrectly reduces reserved commit tx fee

03

Fixes issue #4563

04

New unit test covering spiked feerate HTLC reserve behavior

Risk score

Why this scored 60/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.