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

Pick NegotiationFailureReason at error construction

Public commit record

What the developer wrote

Authored by Jeffrey Czyz

73/100 · Adequate
Pick NegotiationFailureReason at error construction

QuiescentError::FailSplice was built with a placeholder
NegotiationFailureReason::Unknown and expected callers to chain a
with_negotiation_failure_reason builder. Sites that forgot the chain
leaked Unknown into Event::SpliceNegotiationFailed, and the pattern
forced splice-specific reason vocabulary into the generic
QuiescentAction helper.

Each call site in propose_quiescence now picks the reason at
construction. The pending-quiescent-action branch is unreachable, so
it asserts unconditionally; the match retains arms for both action
variants so release builds return a sensible error if the invariant
is violated. abandon_quiescent_action returns SpliceFundingFailed
directly without round-tripping through QuiescentError, since the
reason was always discarded there.

Make funding_contributed's pending-quiescent-action check exhaustive
on QuiescentAction. A future variant produces a compile error here
and at the matching arm in propose_quiescence, forcing the author to
decide how it interacts with funding contribution.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit is a code-quality and correctness fix in a Lightning network library. It removes a risky pattern where an error reason was left as a placeholder ('Unknown') and only filled in later by callers. Some callers forgot to fill it in, so users could see a confusing 'Unknown' reason when a splice negotiation actually failed for a known reason. The change makes the reason mandatory at the moment the error is created, and removes a helper that made it easy to forget. It is not a direct exploit fix, but it prevents a class of state-reporting bugs that could hide what went wrong during channel operations.

Recommended action

Review as a defensive correctness improvement. No urgent deployment required for security reasons, but include in normal release cycle to prevent misleading failure reasons in splice negotiation events. Ensure tests cover both ChannelClosing and Unknown reason paths.

Security signals we found

01

Elimination of placeholder error reason that could be leaked to event consumers

02

Removal of builder pattern that allowed callers to forget setting a security-relevant failure reason

03

Addition of debug_assert! and exhaustive match to enforce invariants at compile time

04

Refactoring only; no new cryptographic, network, or memory-safety vulnerability introduced

Risk score

Why this scored 27/100

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