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

Add test for monitor update after funding spend

Public commit record

What the developer wrote

Authored by Joost Jager

78/100 · Adequate
Add test for monitor update after funding spend

Add a regression test that reproduces the panic when a commitment_signed
is processed after the counterparty commitment transaction has confirmed.
The ChannelMonitor's no_further_updates_allowed() returns true, causing
update_monitor to fail, which ChainMonitor overrides to InProgress. A
subsequent preimage claim returning Completed then triggers the
per-channel assertion that Completed must not follow InProgress.

AI tools were used in preparing this commit.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit adds a regression test that reproduces a crash (panic) in the Lightning Dev Kit's channel monitoring logic. The crash happens when a blockchain event and a peer message arrive in an unlucky order: after the counterparty's commitment transaction confirms on-chain, the local node still processes a new commitment_signed message from that peer. The code marks the channel monitor as frozen, but a later legitimate payment preimage claim returns a success status, conflicting with the earlier frozen status and triggering an internal assertion that crashes the node.

Recommended action

Treat this as a known bug reproducer. A follow-up patch should reconcile ChannelMonitorUpdateStatus transitions when update_monitor returns Err after funding_spend_seen, ensuring that a later Completed update does not trigger the InProgress->Completed assertion. Reviewers should verify the eventual fix in ChainMonitor::update_channel or ChannelMonitor::update_monitor and add a non-panic version of this test.

Security signals we found

01

panic/assertion failure in channel monitor state machine

02

race condition between on-chain confirmation and peer message processing

03

InProgress/Completed status mismatch after error override

04

regression test for denial-of-service-like node crash

05

no code fix present in this commit

Risk score

Why this scored 56/100

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