What changed, and why it matters
This is a tiny follow-up patch that removes a single 'assert' statement in Electrum's Lightning code. The assert was causing the program to crash when checking whether a payment hash was 'public' if the payment preimage was not known. Removing it lets the function return False instead of crashing. This is likely a bug-fix for a crash or denial-of-service condition, but the commit message gives almost no detail and there is no disclosed security context.
Treat as a low-severity stability/defensive fix. Review related Lightning code paths for other assumptions that missing preimages may violate, especially around payment forwarding, invoice handling, or trampoline payments. If this crash was reachable from remote input, consider whether it could be triggered by a peer to deny service.
Security signals we found
Removal of an assertion that could crash the application on missing data
Potential denial-of-service vector: unhandled assertion failure in Lightning payment handling
Follow-up to a prior change (#10442), suggesting a recently touched code path
No explicit security framing by the vendor
Evidence from the diff
In electrum/lnworker.py, the method is_public_payment_hash(payment_hash) previously asserted that preimage_hex is not None after looking it up in self._preimages. If the preimage was absent, the assertion would raise AssertionError, crashing the caller. The patch removes the assert so the function falls through to return bool(is_public), where is_public would be None and bool(None) is False. This prevents a crash when the preimage is unknown. The change is defensive and aligns with the commit message ‘this assert fails if we do not have the preimage’.
Changed components
electrum/lnworker.pyLNWallet.is_public_payment_hashLightning Network payment handlingInspect captured patch +0 / −1
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
index 9727eca..0797023 100644
--- a/electrum/lnworker.py
+++ b/electrum/lnworker.py
@@ -2751,7 +2751,6 @@ class LNWallet(Logger):
"""
assert isinstance(payment_hash, bytes), f"expected bytes, but got {type(payment_hash)}"
preimage_hex, is_public = self._preimages.get(payment_hash.hex(), (None, None))
- assert preimage_hex is not None
return bool(is_public)
def get_payment_info(self, payment_hash: bytes, *, direction: lnutil.Direction) -> Optional[PaymentInfo]:
Why this scored 33/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.