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

lnworker: prevent creation of PaymentInfo with 0 exp

Public commit record

What the developer wrote

Authored by f321x

93/100 · Strong
lnworker: prevent creation of PaymentInfo with 0 exp

In some parts of the application 0 (sec) == no expiry, however we
use `LN_EXPIRY_NEVER` (100 years) instead of 0 for lightning invoices.

This replaces a 0 second expiry with `LN_EXPIRY_NEVER` in
`LNWallet.create_payment_info()` to prevent htlcs for no-expiry invoices
from getting failed incorrectly (which the assert prevented)
and fix the assertion error in #10350.

Fixes #10350.

# Conflicts:
# electrum/lnworker.py
✓ Specific, 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 bug in Electrum's Lightning invoice handling where an invoice with no expiry date could be stored with an expiry of 0 seconds. In Electrum, 0 seconds means 'no expiry' in some places, but the Lightning code expects a special 'never expire' value (100 years) instead. The bug caused an internal assertion to fail, which could crash the wallet or make incoming Lightning payments fail unexpectedly. The fix replaces 0 with the proper 'never expire' value when creating payment information.

Recommended action

Review whether other code paths that construct PaymentInfo or handle invoice expiry also normalize 0 to LN_EXPIRY_NEVER. Consider adding a regression test for no-expiry Lightning invoices. Users should update to a version containing this fix if they use Lightning and encounter crashes or failed incoming payments with no-expiry invoices.

Security signals we found

01

Assertion failure in payment info creation

02

Lightning invoice expiry handling inconsistency

03

Potential denial-of-service via malformed/crafted no-expiry invoice

04

Fixes user-reported crash issue #10350

Risk score

Why this scored 32/100

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