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

chanstate: match active htlcs by identity

Public commit record

What the developer wrote

Authored by ziggie

78/100 · Adequate
chanstate: match active htlcs by identity

ActiveHtlcs previously matched HTLCs across the local and remote
commitment snapshots by hashing the onion blob. The onion blob is
routing payload data and can be duplicated by buggy or malicious
senders, so it is not a reliable key for identifying the same HTLC on
both commitments.

Match on the HTLC's channel identity instead: the channel-level HTLC
index combined with the direction of the offer uniquely identifies an
offered HTLC within the channel state. A test is added to lock in the
new matching behavior.
✓ 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 change fixes how the Lightning Network Daemon (LND) decides which pending payments (HTLCs) are considered 'active' in a payment channel. Previously, it matched HTLCs between the two sides of a channel by hashing the onion routing blob, which is not a unique identifier and can be duplicated by accident or on purpose. Now it matches by the HTLC's channel-level index and direction, which is a reliable identifier. The old behavior could have caused LND to misidentify active HTLCs when onion blobs were duplicated, potentially affecting channel state decisions.

Recommended action

Review downstream consumers of ActiveHtlcs to confirm they rely on the corrected identity semantics, and ensure the fix is included in any release branch. Consider whether the prior behavior could have led to incorrect HTLC inclusion/exclusion in channel state and whether additional hardening (e.g., invariant checks) is warranted.

Security signals we found

01

Use of non-unique routing payload (onion blob) as a matching key for channel state

02

Potential for duplicate onion blobs to cause ActiveHtlcs to misidentify HTLCs locked on both commitments

03

Fix aligns HTLC matching with channel-level identity (HtlcIndex + direction)

04

Test added to lock in correct matching behavior

Risk score

Why this scored 61/100

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