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

qml: refactor invoice amount checks, msat precision for lightning. add qeconfig unit tests for conversion methods.

Public commit record

What the developer wrote

Authored by Sander van Grieken

75/100 · Adequate
qml: refactor invoice amount checks, msat precision for lightning.
add qeconfig unit tests for conversion methods.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a precision bug in Electrum's mobile/QML interface when handling very small Lightning payments. Previously, amounts were rounded to whole satoshis too early, which could cause the app to reject valid Lightning invoices that require millisecond-precision amounts, or to miscalculate whether the user has enough balance. The change also cleans up duplicate balance-check code and adds unit tests.

Recommended action

Review the refactored check_can_pay_amount logic for off-by-1000 errors and ensure msat/satoshi comparisons remain consistent across all Lightning payment flows. Run the new unit tests and consider additional integration tests for Lightning invoice payment edge cases.

Security signals we found

01

Amount precision loss in payment path could lead to incorrect payment validation

02

Lightning invoice minimum-amount check previously used satoshi-rounded value, potentially allowing underpayment or over-rejection

03

Refactoring consolidates duplicated balance/can-pay logic, reducing risk of inconsistent validation

04

New unit tests added for amount conversion edge cases

Risk score

Why this scored 32/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 4/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.