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

channelnotifier: add NotifyEarlyClosedChannelEvent

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

73/100 · Adequate
channelnotifier: add NotifyEarlyClosedChannelEvent

Today NotifyClosedChannelEvent rebuilds its event by round-tripping
through FetchClosedChannel, which forces the caller to have already
persisted the close summary to the closed-channel bucket. The chain
watcher needs to surface a CLOSED_CHANNEL event to RPC subscribers as
soon as a coop close spend is first detected on chain, well before
the close has reached the required confirmation depth at which the
state machine would normally call MarkChannelClosed.

In this commit, we add NotifyEarlyClosedChannelEvent, which dispatches
a ClosedChannelEvent built from a caller-supplied summary directly
through the subscribe server. The summary is expected to carry
IsPending=true so subscribers can recognize that the close has not
yet been finalized in the database.

Two unit tests assert that the new path delivers the supplied summary
verbatim and produces exactly one event per call.
✓ Specific, descriptive subject✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit adds a new internal notification path in LND so that the chain watcher can tell RPC subscribers about a cooperative channel close as soon as it is seen on the Bitcoin blockchain, before the usual database bookkeeping is finished. It is a feature/refactoring change, not a fix for an active security bug. The new function simply forwards a caller-supplied close summary to subscribers without reading from the database.

Recommended action

Review the chain watcher integration that will call this new function to ensure it always sets IsPending=true and supplies a correct, consistent ChannelCloseSummary. Consider whether subscribers of CLOSED_CHANNEL events handle IsPending=true safely, since they may now receive events before the close is finalized in the database. No immediate security patch is indicated by this commit alone.

Security signals we found

01

New internal notification dispatch path bypasses database lookup

02

Caller-supplied summary is forwarded directly to subscribers

03

Expected use case relies on caller setting IsPending=true

04

No input validation or sanitization visible in the new function

05

No authentication/authorization changes

Risk score

Why this scored 18/100

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