lnworker: set OPTION_ONION_MESSAGE_OPT feature if we are forwarding.
What changed, and why it matters
This commit changes how Electrum advertises its Lightning network features. When the wallet is configured to forward payments (including trampoline payments), it now tells other nodes it supports onion messages. This is a protocol-correctness fix: a node that forwards payments should advertise the feature it is actually using. It is not a fix for an active exploit, but it removes a minor inconsistency that could affect interoperability or routing.
No urgent action. Treat as a normal correctness/interoperability patch. Users running experimental Lightning forwarding should update to keep feature advertisement consistent with behavior.
Security signals we found
Feature-bit advertisement now matches actual forwarding capability
Experimental forwarding options gated the new advertisement
No input validation, parsing, or cryptographic code modified
No memory-safety, authentication, or authorization changes
Evidence from the diff
In electrum/lnworker.py, the feature bitset constructed during LNWallet initialization now sets OPTION_ONION_MESSAGE_OPT when either EXPERIMENTAL_LN_FORWARD_PAYMENTS or EXPERIMENTAL_LN_FORWARD_TRAMPOLINE_PAYMENTS is enabled. Previously, a forwarding node did not signal onion-message support, which is required/expected behavior for nodes that forward onion messages. The change is two lines and only affects feature advertisement; no logic for message handling or forwarding is changed.
Changed components
electrum/lnworker.pyLightning feature advertisement (init message feature bits)Inspect captured patch +2 / −0
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
index 6e8a101..1501ef0 100644
--- a/electrum/lnworker.py
+++ b/electrum/lnworker.py
@@ -869,6 +869,8 @@ class LNWallet(LNWorker):
features |= LnFeatures.OPTION_ANCHORS_ZERO_FEE_HTLC_OPT
if self.config.ACCEPT_ZEROCONF_CHANNELS:
features |= LnFeatures.OPTION_ZEROCONF_OPT
+ if self.config.EXPERIMENTAL_LN_FORWARD_PAYMENTS or self.config.EXPERIMENTAL_LN_FORWARD_TRAMPOLINE_PAYMENTS:
+ features |= LnFeatures.OPTION_ONION_MESSAGE_OPT
if self.config.EXPERIMENTAL_LN_FORWARD_PAYMENTS and self.config.LIGHTNING_USE_GOSSIP:
features |= LnFeatures.GOSSIP_QUERIES_OPT # signal we have gossip to fetch
LNWorker.__init__(self, self.node_keypair, features, config=self.config)
Why this scored 19/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.