From 2f2340d69f07792cab4c018259a891c17625774d Mon Sep 17 00:00:00 2001 From: f321x Date: Wed, 10 Dec 2025 11:44:45 +0100 Subject: [PATCH] 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 --- electrum/lnworker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index ee7caab05..9fefeb16b 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -146,7 +146,7 @@ class PaymentInfo: assert isinstance(self.direction, int) assert isinstance(self.status, int) assert isinstance(self.min_final_cltv_delta, int) - assert isinstance(self.expiry_delay, int) and self.expiry_delay > 0 + assert isinstance(self.expiry_delay, int) and self.expiry_delay > 0, repr(self.expiry_delay) assert isinstance(self.creation_ts, int) assert isinstance(self.invoice_features, LnFeatures) @@ -2414,7 +2414,7 @@ class LNWallet(LNWorker): direction=RECEIVED, status=PR_UNPAID, min_final_cltv_delta=min_final_cltv_delta, - expiry_delay=exp_delay, + expiry_delay=exp_delay or LN_EXPIRY_NEVER, invoice_features=invoice_features, ) self.save_preimage(payment_hash, payment_preimage, write_to_disk=False)