lnrouter: add note about can_pay() false positives for concurrent MPP routes
What changed, and why it matters
This commit only adds a code comment explaining a known limitation in Electrum's Lightning payment routing. It does not change any behavior. The note warns that when sending a payment split across multiple routes (multi-path payments, or MPP), the router's check of whether a channel can afford a given amount may occasionally give a wrong answer because it doesn't yet know about other routes being constructed at the same time. This is a documentation-only change, not a fix or an active vulnerability.
No immediate action is required for this commit. Treat it as a developer note. If the described false positive is later shown to cause payment failures or fee/liquidity issues, a separate code change should be reviewed.
Security signals we found
Comment-only change
Acknowledges a race condition / false positive in MPP route feasibility checks
No functional patch or mitigation present
Evidence from the diff
The diff inserts a three-line comment in electrum/lnrouter.py inside LNPathFinder, immediately after a can_pay() check used during route selection. The comment explains that for concurrent MPP route construction, can_pay() may produce false positives because other HTLCs for the same payment have been logically selected but not yet committed to the channel state. No logic is modified; the existing behavior is preserved and merely annotated.
Changed components
electrum/lnrouter.pyLNPathFinder route selectionMPP (multi-path payment) routingInspect captured patch +3 / −0
diff --git a/electrum/lnrouter.py b/electrum/lnrouter.py
index 790303e..225f452 100644
--- a/electrum/lnrouter.py
+++ b/electrum/lnrouter.py
@@ -597,6 +597,9 @@ class LNPathFinder(Logger):
continue
if not ignore_amount_constraints \
and not my_sending_channels[edge_channel_id].can_pay(amount_msat, check_frozen=True):
+ # note: in case of MPP, we might be constructing multiple routes for different HTLCs around the same time,
+ # and only a tiny bit later will the HTLCs get added to the channels. If another HTLC has not been
+ # added yet but we already selected to use the same channel for it, this "can_pay()" can return a false positive.
continue
edge_cost, fee_for_edge_msat = self._edge_cost(
short_channel_id=edge_channel_id,
Why this scored 11/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.