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

Explicitly match on-the-fly HTLCs after a restart (#3357)

Public commit record

What the developer wrote

Authored by Bastien Teinturier

93/100 · Strong
Explicitly match on-the-fly HTLCs after a restart (#3357)

When we restart our node, we look at HTLCs that have been received but
not relayed yet: they must be failed back, otherwise we would let them
in the incoming channel until their timeout is reached, which would
force our peer to force-close.

There is an exception for HTLCs that are paying for an on-the-fly funded
channel: we will explicitly retry relaying those HTLCs, even after a
restart, because that's how we get paid for the funding fees. We were
only matching them by `payment_hash`, which wasn't precise enough: an
attacker could initiate an on-the-fly channel and then send unrelated
HTLCs that use the same `payment_hash`, just to mess up with us and get
some of our channels force-closed.

We already have the detailed information about on-the-fly HTLCs in our
DB, so we now use that to match HTLCs on the corresponding `channel_id`
and `htlc_id`, which guarantees uniqueness.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in the Eclair Lightning node where, after a restart, the node could be tricked into keeping the wrong incoming payments alive. An attacker could reuse the same payment identifier (payment_hash) from a legitimate in-flight channel funding request on unrelated payments. Because the old code matched only by payment_hash, those unrelated payments would be treated as part of the funding flow and not failed back. If left unresolved until their deadline, this could force the node to force-close its channels, costing money and disrupting service. The fix matches by the exact channel and HTLC identifier instead, which is unique.

Recommended action

Apply this patch promptly. Nodes running versions before this commit should plan to upgrade, especially if they accept on-the-fly (splice-in / liquidity) channel funding requests, because the bug can be exploited to cause force-closures. Monitor channels for unexpected force-closes after restarts.

Security signals we found

01

Fixes a logic bug that could lead to forced channel closures

02

Attack vector: payment_hash reuse to pin unrelated HTLCs

03

Changes identifier from payment_hash to unique (channel_id, htlc_id)

04

Adds regression test for malicious payment_hash reuse

05

Commit message explicitly describes security relevance and attacker behavior

Risk score

Why this scored 72/100

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