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

Hold in-flight monitor updates until background event processing

Public commit record

What the developer wrote

Authored by Wilmer Paulino

83/100 · Strong
Hold in-flight monitor updates until background event processing

We previously assumed background events would eventually be processed
prior to another `ChannelManager` write, so we would immediately remove
all in-flight monitor updates that completed since the last
`ChannelManager` serialization. This isn't always the case, so we now
keep them all around until we're ready to handle them, i.e., when
`process_background_events` is called.

This was discovered while fuzzing `chanmon_consistency_target` on the
main branch with some changes that allow it to connect blocks. It was
triggered by reloading the `ChannelManager` after a monitor update
completion for an outgoing HTLC, calling
`ChannelManager::best_block_updated`, and reloading the `ChannelManager`
once again. A test is included that provides a minimal reproduction of
this case.
✓ 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 patch fixes a bug in the Lightning Dev Kit's channel manager where completed channel monitor updates could be dropped during reloads before their follow-up actions were processed. If a ChannelManager was saved, a monitor update finished, and then the ChannelManager was reloaded and saved again without background events being processed, the channel could get stuck and never resume normal operation. The fix holds onto completed updates until the background event processor can handle them, and includes a regression test.

Recommended action

Review and merge the patch; ensure downstream users running nodes with async monitor persistence upgrade, as the bug can leave channels unable to resume after reloads. No immediate remote exploit path is evident, but the fix prevents a liveness/consistency failure that could affect routing and funds availability.

Security signals we found

01

State consistency bug between ChannelManager and ChannelMonitor persistence

02

Potential channel stall / funds lockup due to missing monitor update completion actions

03

Race condition triggered by serialization before background event processing

04

Discovered via fuzzing `chanmon_consistency_target`

05

Fix includes regression test

Risk score

Why this scored 57/100

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