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

Fix async release before HTLC decode

Public commit record

What the developer wrote

Authored by Valentine Wallace

88/100 · Strong
Fix async release before HTLC decode

Handle `ReleaseHeldHtlc` messages that arrive before the sender-side LSP
has even queued the held HTLC for onion decoding. Unlike lightningdevkit#4106, which
covers releases arriving after the HTLC is in `decode_update_add_htlcs`
but before it reaches `pending_intercepted_htlcs`, this preserves
releases that arrive one step earlier and would otherwise be dropped as
HTLC not found.

Co-Authored-By: HAL 9000
Co-Authored-By: Elias Rohrer <dev@tnull.de>
✓ 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 race condition in Lightning Dev Kit's async payments feature. When a user wants to receive a payment while offline, their LSP (Lightning Service Provider) holds the payment until they come back online. The bug occurred when a 'release this payment' message arrived *before* the held payment had been fully registered in the LSP's internal state. Previously, the release message would be ignored, causing the payment to get stuck. The fix makes the LSP remember the release request and apply it once the payment is registered.

Recommended action

Treat as a functional/availability bug with possible security relevance for payment liveness. Reviewers should verify that release_pending_inbound_held_htlc only clears hold_htlc on genuinely held HTLCs and cannot be abused to release non-held HTLCs, and confirm the regression test covers both success and failure paths. No immediate emergency response is indicated, but the fix should be included in the next release.

Security signals we found

01

Race condition in async payment release handling

02

Held HTLC could be left stuck instead of released

03

New defensive state-clearing path for pre-commitment release messages

04

Regression test added for release-before-hold-registered scenario

05

References prior fix lightningdevkit#4106 for a related but distinct race window

Risk score

Why this scored 57/100

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