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

wallet: clamp absurd inflight funding feerates on upgrade

Public commit record

What the developer wrote

Authored by cdecker

86/100 · Strong
wallet: clamp absurd inflight funding feerates on upgrade

The bounds in the previous commits only apply to feerates arriving from
now on. Nodes that already recorded an absurd `funding_feerate` for an
inflight splice or dual-fund RBF are stuck: the BOLT #2 rule that the
next RBF pays 25/24 times the last feerate is computed on a u32, so
anything above UINT_MAX/25 overflows and trips the
assert(next_feerate > last_feerate) in listpeerchannels. Plugins call
listpeerchannels at startup, so such a node crash-loops with no way out
but to rewrite the stored value.

Clamp it on upgrade. Note we write the feerate with db_bind_int(), so a
u32 above INT_MAX reads back negative; those are exactly the values that
overflow, hence the second clause.

Rewriting is safe: this feerate only sanity checks the fee the funding
transaction already pays and tells the user what the next RBF has to
beat. It never feeds anything we have signed, and lowering it only
relaxes the check.

Changelog-Fixed: lightningd: nodes that stored an out-of-range feerate for an in-progress splice no longer crash-loop on `listpeerchannels`; the stored feerate is clamped on upgrade.
(cherry picked from commit 0393174cb312079da1e0d272640cac145ccdf4c7)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug where Core Lightning nodes could get stuck in a crash loop. If a node had previously stored an extremely high or zero fee rate for an in-progress channel funding operation (a 'splice' or dual-funded channel RBF), a later code check would overflow or fail an assertion when listing peer channels. Since plugins call that list at startup, the node would keep crashing. The fix adds a database upgrade step that clamps those bad stored values to safe limits when the node starts up after updating.

Recommended action

Apply the patch and ensure nodes are upgraded so the migration runs before any plugin triggers listpeerchannels. Operators of nodes that have done splicing or dual-funded RBF should upgrade promptly to avoid crash loops. No manual database editing is needed after this migration runs.

Security signals we found

01

Integer overflow in fee-rate calculation (u32 overflow when multiplying by 25/24)

02

Assertion failure leading to daemon crash loop at startup

03

Database migration clamps out-of-range stored funding feerates

04

Negative stored values caused by signed/unsigned mismatch (db_bind_int vs u32)

05

Crash triggered by plugin calls to listpeerchannels during startup

Risk score

Why this scored 53/100

Our methodology →
Potential impact 18/30
Exploitability 10/25
Stealth signal 5/15
Affected reach 8/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.