xpay: remove internal "disable_mpp" flag.
What changed, and why it matters
This is a small internal cleanup in Core Lightning's xpay plugin. It removes a redundant 'disable_mpp' flag and instead uses the existing 'maxparts' setting (set to 1) to achieve the same effect of disabling multi-part payments. The behavior appears functionally equivalent.
No immediate action required. Reviewers may want to confirm that setting maxparts=1 provides equivalent routing behavior to the removed `auto.no_mpp_support` layer, particularly for invoices that do not advertise MPP support.
Security signals we found
Refactoring of payment routing logic
Removal of explicit MPP disabling layer ('auto.no_mpp_support')
Behavioral equivalence claim in commit message
Evidence from the diff
The commit refactors the xpay plugin’s handling of multi-part payment (MPP) disabling. Previously, a struct payment field disable_mpp tracked whether MPP should be disabled based on invoice feature bits. The patch removes that field and instead sets payment->maxparts = 1 when the invoice does not offer OPT_BASIC_MPP. The previous code also added an auto.no_mpp_support layer to the getroutes request when disable_mpp was true; this layer addition is removed entirely. The log message now checks maxparts == 1 instead of disable_mpp.
Changed components
plugins/xpay/xpay.cInspect captured patch +7 / −7
diff --git a/plugins/xpay/xpay.c b/plugins/xpay/xpay.c
index 43f76d97..0b365d2f 100644
--- a/plugins/xpay/xpay.c
+++ b/plugins/xpay/xpay.c
@@ -87,8 +87,6 @@ struct payment {
u32 maxdelay;
/* If non-zero: maximum number of payment routes that can be pending. */
u32 maxparts;
- /* Do we have to do it all in a single part? */
- bool disable_mpp;
/* BOLT-11 payment secret (NULL for BOLT-12, it uses blinded paths) */
const struct secret *payment_secret;
/* BOLT-11 payment metadata (NULL for BOLT-12, it uses blinded paths) */
@@ -1483,8 +1481,6 @@ static struct command_result *getroutes_for(struct command *aux_cmd,
/* Add user-specified layers */
for (size_t i = 0; i < tal_count(payment->layers); i++)
json_add_string(req->js, NULL, payment->layers[i]);
- if (payment->disable_mpp)
- json_add_string(req->js, NULL, "auto.no_mpp_support");
json_array_end(req->js);
json_add_amount_msat(req->js, "maxfee_msat", maxfee);
json_add_u32(req->js, "final_cltv", payment->final_cltv);
@@ -1757,7 +1753,7 @@ preapproveinvoice_succeed(struct command *cmd,
"xpay-%"PRIu64, payment->unique_id);
/* Now unique_id is set, we can log this message */
- if (payment->disable_mpp)
+ if (payment->maxparts == 1)
payment_log(payment, LOG_INFORM, "No MPP support: this is going to be hard to pay");
return populate_private_layer(cmd, payment);
@@ -1966,6 +1962,7 @@ static struct command_result *xpay_core(struct command *cmd,
struct xpay *xpay = xpay_of(cmd->plugin);
struct gossmap *gossmap = get_gossmap(xpay);
struct node_id dstid;
+ bool disable_mpp;
u64 now, invexpiry;
struct out_req *req;
const char *err;
@@ -2049,7 +2046,7 @@ static struct command_result *xpay_core(struct command *cmd,
* - otherwise:
* - MUST NOT use multiple parts to pay the invoice.
*/
- payment->disable_mpp = !feature_offered(b12inv->invoice_features, OPT_BASIC_MPP);
+ disable_mpp = !feature_offered(b12inv->invoice_features, OPT_BASIC_MPP);
} else {
struct bolt11 *b11
= bolt11_decode(tmpctx, payment->invstring,
@@ -2085,7 +2082,7 @@ static struct command_result *xpay_core(struct command *cmd,
else
payment->full_amount = *msat;
- payment->disable_mpp = !feature_offered(b11->features, OPT_BASIC_MPP);
+ disable_mpp = !feature_offered(b11->features, OPT_BASIC_MPP);
if (amount_msat_is_zero(payment->full_amount))
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"Cannot pay bolt11 invoice with zero amount");
@@ -2130,6 +2127,9 @@ static struct command_result *xpay_core(struct command *cmd,
else
payment->maxparts = 0;
+ if (disable_mpp)
+ payment->maxparts = 1;
+
/* Now preapprove, then start payment. */
if (command_check_only(cmd)) {
req = jsonrpc_request_start(cmd, "check",
Why this scored 18/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.