lnworker: (trivial) get_payment_bundle to not return None
What changed, and why it matters
This is a tiny one-line fix in Electrum's Lightning code. A helper function that looks up groups of related payments now returns an empty list instead of 'None' when nothing is found. This mainly prevents other code that expects a list from mishandling the result, which could reduce bugs or minor errors but is not a clear security vulnerability on its own.
Treat as a minor code-quality/defensive fix. Review callers of get_payment_bundle to confirm they now safely handle the empty-list case and that no None-specific logic elsewhere relied on the old behavior.
Security signals we found
Implicit None return replaced with empty list
Defensive type consistency in payment bundle lookup
Potential downstream None-deref/iteration bug mitigated
Evidence from the diff
The commit changes LNWallet.get_payment_bundle() in electrum/lnworker.py to explicitly return [] when payment_key is not found in any bundle. Previously the function would return None implicitly. Callers expecting a list could fail or behave unexpectedly if they iterate or check membership on the result without handling None. The change is defensive and reduces type-unsafe behavior, but the diff alone does not show an exploitable flaw.
Changed components
electrum/lnworker.pyLNWallet.get_payment_bundleInspect captured patch +1 / −0
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
index 6395aa3..d5a8fc0 100644
--- a/electrum/lnworker.py
+++ b/electrum/lnworker.py
@@ -2316,6 +2316,7 @@ class LNWallet(LNWorker):
for key_list in self.payment_bundles:
if payment_key in key_list:
return key_list
+ return []
def save_preimage(self, payment_hash: bytes, preimage: bytes, *, write_to_disk: bool = True):
if sha256(preimage) != payment_hash:
Why this scored 29/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.