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

contractcourt+itest: tests for coop close insta-dispatch

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

83/100 · Strong
contractcourt+itest: tests for coop close insta-dispatch

In this commit, we add three focused unit tests in contractcourt
plus an itest that exercises the regression end-to-end.

The chain watcher harness gains an opt-in early-dispatch capture that
records every notifyEarlyCoopClose invocation so tests can assert how
many fired and what summaries they carried. On top of that:

TestEarlyDispatchCoopClose verifies the headline behavior. An
async-path coop close fires exactly one early dispatch with
IsPending=true and the post-N-conf flow still produces the regular
CooperativeCloseInfo downstream.

TestEarlyDispatchForceCloseNotInvoked guards the carve-out: force
closes never fire the early dispatch since their CLOSED_CHANNEL
event timing is intentionally unchanged.

TestEarlyDispatchReorgRefiresOnReReplacement nails down the reorg
path. Once a deep reorg removes the close, the early-dispatch flag
is cleared and the next coop close re-fires the early event with its
own summary, so a subscriber observes each distinct close attempt.

testZeroConfCoopCloseSubscribeEvents brings up a zero-conf channel
between Alice and Bob with --dev.force-channel-close-confs=3 so the
chain watcher takes the async multi-confirmation path. Alice
subscribes to channel events, initiates a cooperative close, and the
test asserts that CLOSED_CHANNEL fires after only one confirmation
of the close tx (not after the full three) and that
FULLY_RESOLVED_CHANNEL arrives once the close has reached three
confirmations. A quiet-window assertion at the end verifies that
exactly one CLOSED_CHANNEL event is delivered. If the suppression in
MarkChannelClosed broke and let it re-fire NotifyClosedChannel at N
confs, this assertion would catch the duplicate.
✓ Specific, 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 is a follow-up test and release-note patch for a previously fixed LND bug. The underlying issue was that subscribers listening for channel close events would not receive the 'CLOSED_CHANNEL' notification until a cooperative close transaction had been buried several blocks deep, instead of being told immediately when the close first appeared on-chain. The commit itself only adds unit tests and an integration test that prove the fix works, plus a release-note entry describing the restored behavior. It does not change production code, so it cannot introduce a new exploitable vulnerability on its own.

Recommended action

No immediate action required; this is a test-only commit validating a prior fix. Reviewers should confirm the corresponding production fix (PR 10794) is already merged and that the new tests pass in CI.

Security signals we found

01

Regression test for event-dispatch timing

02

Release notes describe restored first-conf CLOSED_CHANNEL dispatch

03

Tests assert duplicate CLOSED_CHANNEL suppression

04

Tests cover reorg/replacement re-fire behavior

05

No production code changes in diff

Risk score

Why this scored 39/100

Our methodology →
Potential impact 12/30
Exploitability 0/25
Stealth signal 5/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.