lnwallet: use split config channel for single channel mpp
What changed, and why it matters
This commit fixes a bug in Electrum's Lightning payment logic. When sending a payment split into multiple parts over a single channel, the app could previously ignore the intended channel and route all parts through a different channel that lacked enough capacity. That caused the payment to fail with an internal assertion error. The fix ensures the chosen channel from the split configuration is actually used.
Treat as a routine bug-fix patch. Users relying on Lightning single-channel MPP payments should upgrade to avoid payment failures. No immediate security response is indicated by the commit content.
Security signals we found
Fixes a logic bug that could cause Lightning payment failures
Prevents internal assertion failure (_assert_can_add_htlc) during payment routing
Ensures split configuration channel selection is honored during pathfinding
Evidence from the diff
In lnworker.py, the code previously restricted pathfinding to a single channel only when the split configuration spanned multiple channels (is_multichan_mpp). For single-channel multi-part payments (MPP), it allowed pathfinding over all active channels. This mismatch could cause pathfinding to select a different channel than the one the split was computed for, leading to an _assert_can_add_htlc failure when the chosen channel could not accommodate the summed HTLCs. The patch changes the condition to use the specific channel whenever the payment has multiple parts (is_mpp), regardless of whether those parts are across one channel or several.
Changed components
electrum/lnworker.pyLNWallet payment routing and split configuration handlingInspect captured patch +1 / −2
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
index 9681951..dcd49a5 100644
--- a/electrum/lnworker.py
+++ b/electrum/lnworker.py
@@ -2421,7 +2421,6 @@ class LNWallet(Logger):
receiver_pubkey=paysession.invoice_pubkey,
)
for sc in split_configurations:
- is_multichan_mpp = len(sc.config.items()) > 1
is_mpp = sc.config.number_parts() > 1
if is_mpp and not paysession.invoice_features.supports(LnFeatures.BASIC_MPP_OPT):
continue
@@ -2520,7 +2519,7 @@ class LNWallet(Logger):
invoice_pubkey=paysession.invoice_pubkey,
r_tags=paysession.r_tags,
invoice_features=paysession.invoice_features,
- my_sending_channels=[channel] if is_multichan_mpp else my_active_channels,
+ my_sending_channels=[channel] if is_mpp else my_active_channels,
full_path=full_path,
))
if not is_route_within_budget(
Why this scored 30/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.