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

chanstate: fix htlc copy

Public commit record

What the developer wrote

Authored by ziggie

56/100 · Thin
chanstate: fix htlc copy

Copy all HTLC fields when cloning channel commitment state.

The old copy method only copied a subset of scalar fields and copied
into nil slices for Signature and ExtraData. Allocate those slices and
deep-copy custom record values so snapshots and channel copies retain
complete HTLC metadata.
✓ Subject identifies a change✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in how the Lightning Network Daemon (LND) copies payment channel data. When the program made a copy of an HTLC (a pending payment in a Lightning channel), it failed to copy several important fields and did not properly duplicate variable-length data like signatures, extra data, and custom records. This could cause copies or snapshots of channel state to be incomplete or accidentally share mutable data. The fix deep-copies all relevant fields and adds a test to verify the copy is fully independent.

Recommended action

Treat this as a correctness and potential state-integrity bug. Review all call sites of HTLC.Copy() to determine whether incomplete copies could have led to incorrect commitment signatures, stale state, or protocol violations. Include this fix in the next maintenance release and run the new regression test in CI.

Security signals we found

01

Incomplete deep copy of security-relevant channel state

02

Missing fields in HTLC clone (RHash, OnionBlob, HtlcIndex, LogIndex)

03

Nil-slice copy bug for Signature and ExtraData

04

Shallow copy of CustomRecords map sharing mutable byte slices

05

Channel state snapshot integrity risk

Risk score

Why this scored 46/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 7/15
Affected reach 10/15
Confidence 6/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.