lnwallet: don't blacklist chan on unchanged channel update
What changed, and why it matters
This commit fixes a bug in Electrum's Lightning payment routing. Previously, if a payment failed because a channel didn't have enough money (a temporary liquidity issue), Electrum would incorrectly 'blacklist' that channel for an hour, even when it already knew the channel's rules. This made future payments through that channel impossible for an hour, even when smaller payments would have worked. The fix stops this unnecessary blacklisting and instead relies on recorded liquidity hints to retry with smaller amounts.
Users running Electrum with Lightning should update to a version containing this commit to avoid unnecessary payment routing failures. No immediate emergency action is required; this is a reliability improvement rather than a critical security patch.
Security signals we found
Denial-of-service-like self-harm: unnecessary channel blacklisting degrades user's own payment routing capability
Lightning Network routing logic change
Behavioral fix for TEMPORARY_CHANNEL_FAILURE handling
Evidence from the diff
In electrum/lnworker.py, the logic handling channel updates from failure messages is changed. When the channel update status is UNCHANGED and the failure code is TEMPORARY_CHANNEL_FAILURE, the code now sets update=True instead of blacklist=True. This prevents a 1-hour channel blacklist when the failure is likely due to insufficient liquidity rather than a stale channel policy. Liquidity hints in LNPathFinder already handle retry constraints for future HTLC attempts.
Changed components
electrum/lnworker.pyLNWallet channel update handlingLightning payment pathfindingInspect captured patch +6 / −1
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
index edf5eca..13723f7 100644
--- a/electrum/lnworker.py
+++ b/electrum/lnworker.py
@@ -2265,7 +2265,12 @@ class LNWallet(Logger):
self.logger.info(f'channel update is not more recent.')
blacklist = True
elif r == UpdateStatus.UNCHANGED:
- blacklist = True
+ if failure_msg.code == OnionFailureCode.TEMPORARY_CHANNEL_FAILURE:
+ # the sent htlc might have exceeded the channel's liquidity, no need to blacklist,
+ # we record liquidity hints and can attempt again with a smaller htlc
+ update = True
+ else:
+ blacklist = True
return blacklist, update
@classmethod
Why this scored 45/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.