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

Merge pull request #11555 from yyforyongyu/invoice-settlement-public

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

73/100 · Adequate
Merge pull request #11555 from yyforyongyu/invoice-settlement-public

invoices: settle after complete HTLC collection
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This large LND patch changes when an ordinary invoice is considered 'paid'. Previously, releasing the preimage (the secret that lets the payer claim the funds) immediately marked the invoice as settled. Now the invoice enters a new intermediate 'PENDING_SETTLE' state and only becomes 'SETTLED' once every released HTLC is finally resolved on-chain or off-chain. If a released HTLC is instead reclaimed by the payer on-chain, the invoice can become 'CANCELED' while keeping any funds that did arrive. The change also persists on-chain HTLC outcomes even when the optional final-resolution storage is disabled, so restart recovery can tell a successful claim from a reclaim. This is a defensive correctness fix: it prevents a merchant from treating a payment as complete before it is truly irreversible, which could lead to shipping goods for a payment that later fails.

Recommended action

Review RPC clients and accounting integrations that assume an invoice reaching SETTLED is permanent and that cancellation implies no preimage was released. Update them to handle ContractPendingSettle, the new HtlcStateFailed, and the preimage_released flag. Before downgrading, ensure no ordinary invoice or HTLC remains in PENDING_SETTLE and no HtlcStateFailed records exist. Operators should plan to run this or a later version rather than downgrade across the state change.

Security signals we found

01

New intermediate invoice/HTLC state prevents premature settlement reporting

02

On-chain HTLC outcomes persisted without opt-in to support restart recovery

03

Forwarding package marker persisted before preimage release to avoid replay rejection on restart

04

Tweakless data-loss close now records ChanStatusLocalDataLoss before archiving

05

Canceled-invoice deletion now preserves ordinary invoices with released HTLC history

06

RPC exposes new PENDING_SETTLE and FAILED states plus preimage_released flag

Risk score

Why this scored 68/100

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