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

Merge PR '`MonitorEvent`s resolve outbound payment claims' (#4545)

Public commit record

What the developer wrote

Authored by wpaulino

81/100 · Strong
Merge PR '`MonitorEvent`s resolve outbound payment claims' (#4545)

from valentinewallace/2026-04-mon-resolves-outb-claims into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/4545
Reviewed-by: wpaulino <wpaulino@noreply.git.rust-bitcoin.org>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit changes how Lightning Dev Kit handles payment claims when an outbound HTLC is resolved. Previously, off-chain payment claims were tied to a specific message-handling flow (RAA release) and could get out of sync with the channel monitor's durable events. The patch makes monitor events the durable source of truth for resolving outbound payments, adds tracking so the same HTLC can have both an off-chain and an on-chain claim event, and ensures older LDK versions (0.3 and earlier) don't misinterpret off-chain events as on-chain ones. It also fixes edge cases around restarts, upgrades, downgrades, and replayed events. The primary risk is not a remote exploit but a correctness/consensus bug that could, in edge cases, lead to stuck payments, phantom balances, or premature payment completion.

Recommended action

Review the new monitor-event acking logic carefully, especially the conditions under which `ack_monitor_event` is called and the duplicate-detection logic for `PaymentSent` events. Run the new upgrade/downgrade and on-chain-after-off-chain tests under fault injection (e.g., simulated persistence failures and restarts) to confirm no double-ack or missed-ack cases. Verify that the `from_onchain` default of `true` for newly-serialized events preserves downgrade safety. Consider whether any downstream consumers of `PaymentForwarded::claim_from_onchain_tx` need updates.

Security signals we found

01

Changes durable persistence format (`HTLCUpdate` adds `from_onchain` TLV field)

02

Changes monitor event ID generation to distinguish on-chain vs off-chain resolutions

03

Adds backward-compatibility guard to avoid writing off-chain HTLC events for LDK 0.3-

04

Refactors event completion actions to ack monitor events only after user processes PaymentSent

05

Adds startup replay path that re-creates outbound payments from monitor events

06

Adds tests for upgrade/downgrade and replayed claim scenarios

Risk score

Why this scored 52/100

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