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

Only claim HTLCs with matching payment hash upon preimage monitor update

Public commit record

What the developer wrote

Authored by Wilmer Paulino

73/100 · Adequate
Only claim HTLCs with matching payment hash upon preimage monitor update

Previously, we'd attempt to claim all HTLCs that have expired or that we
have the preimage for on each preimage monitor update. This happened due
to reusing the code path (`get_counterparty_output_claim_info`) used
when producing all claims for a newly confirmed counterparty commitment.
Unfortunately, this can result in invalid claim transactions and
ultimately in loss of funds (if the HTLC expires and the counterparty
claims it via the timeout), as it didn't consider that some of those
HTLCs may have already been claimed by a separate transaction.

This commit changes the behavior when handling preimage monitor updates
only. We will now only attempt to claim HTLCs for the specific preimage
that we learned via the monitor update. This is safe to do, as even if a
preimage HTLC claim transaction is reorged out, the `OnchainTxHandler`
is responsible for continuous claiming attempts until we see a reorg of
the corresponding commitment transaction.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in the Lightning Dev Kit's on-chain channel monitor. When the user learned a secret payment proof (preimage) and told the monitor about it, the code was accidentally trying to claim every outstanding payment, including ones that had already been claimed. That produced invalid Bitcoin transactions and could let the other side take money via a timeout if the invalid claim failed. The fix narrows the monitor's behavior so it only tries to claim the specific payment whose proof was just learned.

Recommended action

Upgrade to a rust-lightning release containing this commit. Nodes running versions before this fix are at risk of invalid claim transactions and loss of HTLC funds when multiple preimages are learned for the same counterparty commitment. Operators should monitor for any stuck or invalid HTLC claim transactions after force-closes.

Security signals we found

01

Loss-of-funds bug in on-chain HTLC claiming

02

Invalid/double-spend claim transaction generation

03

Missing timeout-path race condition

04

Preimage monitor update over-claims HTLCs

05

Production scenario reproduced in regression test

Risk score

Why this scored 72/100

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