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

fix: stop updating internal invoices inside the listener unlike external one (#3984)

Public commit record

What the developer wrote

Authored by dni ⚡

85/100 · Strong
fix: stop updating internal invoices inside the listener unlike external one (#3984)

Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides an explanatory body✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit reworks how LNbits updates the status of internal (same-system) invoices versus external (Lightning network) invoices. Previously, both kinds were run through the same update path inside a background listener, which could mark internal fiat-backed invoices as paid before the fiat provider actually confirmed payment. The change separates the two flows: external invoices are still updated from the Lightning stream, while internal invoices are now only looked up and dispatched to listeners, relying on the payment service to have already updated them. It also fixes a few related LND REST wallet bugs, such as using the newer 'state' field instead of the deprecated 'settled' field and handling malformed responses more safely.

Recommended action

Treat this as a hardening/reliability fix rather than an active vulnerability patch. Reviewers should verify that internal payments are always updated by `_pay_internal_invoice()` or `check_fiat_status()` before reaching the internal invoice listener, and that no code path still calls the removed `skip_internal_payment_notifications` parameter. Consider adding an explicit guard in `internal_invoice_listener()` to skip or warn if an unsettled internal payment is dispatched. Users running LND REST backends should upgrade to avoid stale `settled`-field behavior.

Security signals we found

01

State-update logic for internal/fiat invoices is separated from external Lightning invoice stream, reducing risk of premature success marking

02

Fiat payment confirmation is now gated on actual fiat provider success before notifications are dispatched

03

LND REST wallet stops relying on deprecated `settled` boolean and uses explicit `state` values, improving correctness of payment status

04

LND REST invoice creation adds defensive parsing for missing/error/malformed fields

05

Internal invoice listener no longer re-checks and re-updates status; it only dispatches already-updated payments

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.