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

Correct HTLC confusion on unrevoked counterparty commitment txs

Public commit record

What the developer wrote

Authored by Matt Corallo

73/100 · Adequate
Correct HTLC confusion on unrevoked counterparty commitment txs

When we see an HTLC on an unrevoked counterparty commitment
transaction we check if it has a corresponding `HTLCSource` when
deciding whether it is likely from a revoked counterparty
commitment transaction. This is insufficient, however, and can
result in us assuming that an HTLC is on a revoked counterparty
commitment (and thus is safe to fail back based on a loose HTLC
match) rather than on a live one.

Here we correct this check and also expand several debug assertions
that validated the detection of the claim style against the HTLC
type into full-blown assertions. If we end up hitting these,
they're almost certainly an indication that something has gone
horribly wrong and either keys have leaked or the node software is
confused and continuing would be unsafe.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This patch fixes a bug in the Lightning Dev Kit where the software could confuse HTLCs (payment contracts) on live, unrevoked counterparty commitment transactions with ones from old, revoked transactions. Previously, it relied only on whether a matching HTLCSource existed, which was not enough. This could lead the node to incorrectly treat a live HTLC as revoked and fail it back, potentially causing loss of funds or channel disruption. The patch also turns several debug-only consistency checks into full assertions that will crash the node if violated, because such violations indicate a serious security failure.

Recommended action

Apply the patch promptly. Nodes running affected versions should upgrade to avoid the risk of incorrectly failing back live HTLCs. Monitor for any assertion panics after upgrade, as they may indicate prior key leakage or state corruption.

Security signals we found

01

Incorrect revocation state detection for counterparty commitment transactions

02

HTLC direction not previously checked when matching against pending HTLCs

03

Promotion of debug assertions to full assertions for HTLC claim path consistency

04

Potential for unsafe fail-back of live HTLCs due to confused revocation status

Risk score

Why this scored 66/100

Our methodology →
Potential impact 22/30
Exploitability 12/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.