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

Don't double-forward HTLCs in rebuilt update_adds map

Public commit record

What the developer wrote

Authored by Valentine Wallace

85/100 · Strong
Don't double-forward HTLCs in rebuilt update_adds map

We recently began reconstructing ChannelManager::decode_update_add_htlcs on
startup, using data present in the Channels. However, we failed to prune HTLCs
from this rebuilt map if a given HTLC was already forwarded to the outbound
edge (we pruned correctly if the outbound edge was a closed channel, but not
otherwise). Here we fix this bug that would have caused us to double-forward
inbound HTLC forwards.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a bug in the Lightning Dev Kit where, after restarting a forwarding node, an already-forwarded payment could be forwarded a second time. The bug only affected the node that restarts, and could lead to duplicate HTLCs being sent downstream, potentially causing funds to be locked or payment failures. The fix prunes already-forwarded HTLCs from a rebuilt in-memory map during startup.

Recommended action

Apply the patch. Nodes running versions with the buggy startup reconstruction should upgrade before restarting forwarding nodes, especially those handling multi-hop payments. Monitor for any duplicate HTLCs or unexpected payment failures after restarts.

Security signals we found

01

Double-forward of HTLCs after node restart

02

State reconstruction bug in deserialization path

03

Incorrect pruning condition in forward map rebuild

04

Regression test added for post-outbound-edge forward persistence

Risk score

Why this scored 68/100

Our methodology →
Potential impact 22/30
Exploitability 10/25
Stealth signal 12/15
Affected reach 10/15
Confidence 9/10
Evidence quality 5/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.