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

Ack monitor events immediately

Public commit record

What the developer wrote

Authored by Valentine Wallace

58/100 · Thin
Ack monitor events immediately

Currently, the resolution of HTLCs (and decisions on when HTLCs can be
forwarded) is the responsibility of Channel objects (a part of ChannelManager)
until the channel is closed, and then the ChannelMonitor thereafter. This leads
to some complexity around race conditions for HTLCs right around channel
closure. Additionally, there is lots of complexity reconstructing the state of
all HTLCs in the ChannelManager deserialization/loading logic.

Instead, we want to do all resolution in ChannelMonitors (in response to
ChannelMonitorUpdates) and pass them back to ChannelManager in the form of
MonitorEvents (similar to how HTLCs are resolved after channels are closed). In
order to have reliable resolution, we'll need to keep MonitorEvents around in
the ChannelMonitor until the ChannelManager has finished processing them. This
will simplify things - on restart instead of examining the set of HTLCs in
monitors we can simply replay all the pending MonitorEvents.

Here for the purposes of merging initial support for persistent monitor events,
we ack each immediately after it is received/handled by the ChannelManager,
which is equivalent to the behavior we had prior to monitor events becoming
persistent.

In upcoming work, we'll want to have much more special handling for HTLCUpdate
monitor events in particular -- e.g. for outbound payment claim events, we
should only ACK the monitor event when the PaymentSent event is processed,
until that point we want it to keep being provided back to us on startup.

All the other monitor events are trivial to ACK, since they don't need to be
re-processed on startup.
✓ Descriptive subject✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit changes how Lightning Dev Kit handles internal notifications called 'monitor events' that report things like completed payments or forced channel closures. Previously these events were not formally acknowledged after being processed. Now the code immediately acknowledges each event after handling it. This is a groundwork change to allow these events to be stored persistently in the future, so they can be safely replayed after a restart. It is described by the authors as behaviorally equivalent to the old code for now, not a security fix.

Recommended action

Treat as a structural/refactoring commit rather than an active vulnerability patch. Reviewers should verify that ack_monitor_event is only called after all state dependent on the event has been durably persisted, especially for HTLCEvent, because premature acknowledgment could affect payment reliability on crash recovery. Monitor the follow-up work mentioned in the commit message that will delay HTLCEvent acknowledgment.

Security signals we found

01

New acknowledgment API introduced for monitor events

02

Immediate ACK of HTLCEvent differs from stated future intent (delayed ACK until PaymentSent processed)

03

Potential reliability concern: if ChannelManager crashes after processing but before persisting, an ACKed HTLCEvent may be lost, though current behavior is described as equivalent to prior non-persistent handling

04

No explicit security bug fixed in commit message

Risk score

Why this scored 30/100

Our methodology →
Potential impact 8/30
Exploitability 4/25
Stealth signal 3/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.