askrene: handle maxparts parameter values 1 and 0.
What changed, and why it matters
This commit fixes how the askrene routing plugin handles the maxparts parameter. Previously, setting maxparts to 1 did not force single-path routing, and setting it to 0 was accepted even though it makes no sense. Now, maxparts=1 forces single-path routing, and maxparts=0 is rejected with an error. This is a minor correctness and input-validation improvement, not a critical security fix.
No urgent action required. Treat as routine bug fix. Users and node operators should update as part of normal maintenance. No evidence of exploitable vulnerability.
Security signals we found
Input validation added for maxparts == 0
Algorithm selection corrected for maxparts == 1
Defensive consistency fix in routing plugin
Evidence from the diff
The patch modifies plugins/askrene/askrene.c. It adds a check that switches the routing algorithm to ALGO_SINGLE_PATH when rq->maxparts == 1, matching the behavior already triggered by the no_mpp_support layer. It also adds an input validation check in json_getroutes() that rejects maxparts == 0 with JSONRPC2_INVALID_PARAMS. The change is defensive and prevents nonsensical or inconsistent parameter combinations.
Changed components
plugins/askrene/askrene.cgetroutes JSON-RPC commandmaxparts parameter handlingInspect captured patch +11 / −0
diff --git a/plugins/askrene/askrene.c b/plugins/askrene/askrene.c
index 8ed0ceab..cce23821 100644
--- a/plugins/askrene/askrene.c
+++ b/plugins/askrene/askrene.c
@@ -639,6 +639,12 @@ static struct command_result *do_getroutes(struct command *cmd,
"Layer no_mpp_support is active we switch to a "
"single path algorithm.");
}
+ if (rq->maxparts == 1 &&
+ info->dev_algo != ALGO_SINGLE_PATH) {
+ info->dev_algo = ALGO_SINGLE_PATH;
+ rq_log(tmpctx, rq, LOG_DBG,
+ "maxparts == 1: switching to a single path algorithm.");
+ }
/* Compute the routes. At this point we might select between multiple
* algorithms. Right now there is only one algorithm available. */
@@ -830,6 +836,11 @@ static struct command_result *json_getroutes(struct command *cmd,
"amount must be non-zero");
}
+ if (maxparts == 0) {
+ return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
+ "maxparts must be non-zero");
+ }
+
if (*maxdelay > maxdelay_allowed) {
return command_fail(cmd, PAY_USER_ERROR,
"maximum delay allowed is %d",
Why this scored 28/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.