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

qml: fix invalid QEInvoiceParser state

Public commit record

What the developer wrote

Authored by f321x

88/100 · Strong
qml: fix invalid QEInvoiceParser state

Fixes the issue described in #10406.
When scanning a lightning invoice we would pass it to
`QEInvoiceParser.fromResolvedPaymentIdentifier()`, however
`fromResolvedPaymentIdentifier()` doesn't reset the state of
`QEInvoiceParser._lnurlData` which is used in QML to evaluate
`payImmediately: invoiceParser.isLnurlPay` in the `onValidationSuccess`
connection.

This change calls `clear()` in `fromResolvedPaymentIdentifier()` to
ensure that `QEInvoiceParser` state gets reset when loading a new invoice.
However when retrieving a bolt11 from a lnurl-pay callback we don't
wan't to reset `QEInvoiceParser._lnurlData` so that `payImmediately` is
true when confirming the lnurl pay dialog, for that I skip calling
`fromResolvedPaymentIdentifier()` and instead call `validateRecipient()`
directly so the `QEInvoiceParser` state doesn't get reset in this case.
✓ 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 state-handling bug in Electrum's mobile/QML interface when scanning or processing payment invoices. Specifically, when a user scanned a Lightning invoice, leftover data from a previous LNURL-pay interaction could remain in the invoice parser, causing the app to think it should still act as an LNURL-pay and potentially pay immediately without showing the normal confirmation. The fix resets parser state when loading a new invoice, except when intentionally continuing an LNURL-pay flow.

Recommended action

Users of the QML/Android version of Electrum should update to a version containing this commit. Review related QML payment flows for any other state variables that may not be reset between invoice parses. Consider adding regression tests covering transitions between LNURL-pay and bolt11 invoice scans.

Security signals we found

01

State not reset between invoice parses, leading to stale LNURL-pay data influencing payment confirmation behavior

02

QML `payImmediately` decision depends on parser state that could be left over from a previous operation

03

Fix explicitly preserves intended LNURL-pay flow while preventing cross-invoice state contamination

Risk score

Why this scored 42/100

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