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

Dont use `is_pre_funded_state` to short-circuit `shutdown` handling

Public commit record

What the developer wrote

Authored by Matt Corallo

73/100 · Adequate
Dont use `is_pre_funded_state` to short-circuit `shutdown` handling

`Channel::is_pre_funded_state` is used to mean several different
things. In this case, its used to skip all the `shutdown` logic as
the funding transaction can't possibly have been broadcasted so
there's really no ned to try to sign a transaction spending it.

Here, we really want to capture any channel in `NegotiatingFunding`
or any V1 channel in `FundingNegotiated` or, finally, any V2
channel in `FundingNegotiated` where we haven't yet sent our
signatures (which is not captured in `is_pre_funded_state`).

Instead of a new helper, we just check the states directly in
`shutdown` handling.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change fixes a logic bug in how the Lightning node decides whether to accept a 'shutdown' message from a peer. Previously, the code used a broad helper called 'is_pre_funded_state' to skip shutdown handling, but that helper did not correctly cover newer V2-style channels that have negotiated funding but not yet sent the node's own transaction signatures. In those cases, a peer could send shutdown and the node might try to run full shutdown logic (including signing a spending transaction) even though the funding transaction was not actually broadcastable yet. The patch narrows the check to the exact channel states where shutdown should be short-circuited.

Recommended action

Treat as a bug-fix patch that may have mild security implications. Reviewers should verify that the new not_broadcasted predicate exactly matches the protocol states where no funding transaction can be on chain, and that no other shutdown invariants (e.g., HTLC handling, signature generation) are reachable in the previously-missed V2 case. No immediate emergency response is indicated, but users running V2 channels should update.

Security signals we found

01

State-machine bypass in shutdown handling

02

Incorrect short-circuit predicate for pre-funding channels

03

Potential signing or error-handling mismatch in V2 channel establishment

04

No explicit security or CVE language in commit

Risk score

Why this scored 42/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 7/15
Confidence 6/10
Evidence quality 3/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.