lnwatcher: ~document behaviour re subbing to historical chans and swaps
What changed, and why it matters
This commit only adds explanatory comments to the Electrum Lightning watcher code. It does not change any program behavior, fix a bug, or introduce new functionality. The comments describe an existing design quirk where the wallet's address database remembers old Lightning channel and swap addresses and may resubscribe to them. There is no security issue visible in the diff itself.
No action required for this commit. Treat it as a non-security documentation change. If concerned about the described behavior, monitor future commits that actually modify the subscription or address-persistence logic.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is a documentation-only change in electrum/lnwatcher.py. It adds a FIXME-style comment block explaining that, despite a subscribe=False parameter, the shared address database (adb.db, persisted to disk) already contains addresses from past Lightning channels and submarine swaps, so the synchronizer will resubscribe to them anyway. No code logic is altered.
Changed components
electrum/lnwatcher.pyInspect captured patch +6 / −0
diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py
index 4db9b04..75ae633 100644
--- a/electrum/lnwatcher.py
+++ b/electrum/lnwatcher.py
@@ -48,6 +48,12 @@ class LNWatcher(Logger, EventListener):
subscribe: bool = True,
) -> None:
if subscribe:
+ # FIXME even when called with subscribe=False, adb likely already has this address.
+ # wallet.adb==lnwatcher.adb, and adb.db==wallet.db, which is persisted to disk.
+ # A call to adb.add_address at any time will add the address to the persistent DB.
+ # So in practice adb has the channel-related and swap-related addresses we *ever*
+ # subscribed to, and will have adb.synchronizer sub to them again.
+ # (even for old redeemed channels and old swaps)
self.adb.add_address(address)
self.callbacks[address] = callback
Why this scored 5/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.