Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -2249,6 +2249,7 @@
"GetRoutes.layers[]": 4,
"GetRoutes.maxdelay": 8,
"GetRoutes.maxfee_msat": 5,
"GetRoutes.maxhops": 10,
"GetRoutes.maxparts": 9,
"GetRoutes.source": 1
},
Expand Down Expand Up @@ -8816,6 +8817,10 @@
"added": "v24.08",
"deprecated": null
},
"GetRoutes.maxhops": {
"added": "v26.12",
"deprecated": null
},
"GetRoutes.maxparts": {
"added": "v25.09",
"deprecated": null
Expand Down
1 change: 1 addition & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17329,6 +17329,14 @@
"Maximum number of routes in the solution."
],
"default": "100"
},
"maxhops": {
"type": "u32",
"added": "v26.12",
"description": [
"Maximum number of hops for every path."
],
"default": "100"
}
}
},
Expand Down
536 changes: 268 additions & 268 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions doc/schemas/getroutes.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
"Maximum number of routes in the solution."
],
"default": "100"
},
"maxhops": {
"type": "u32",
"added": "v26.12",
"description": [
"Maximum number of hops for every path."
],
"default": "100"
}
}
},
Expand Down
14 changes: 11 additions & 3 deletions plugins/askrene/askrene.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ struct getroutes_info {
/* Non-NULL if we are told to use "auto.localchans" */
struct layer *local_layer;
u32 maxparts;
u32 maxhops;
};

static void add_layer(const struct layer ***layers,
Expand Down Expand Up @@ -716,7 +717,11 @@ static struct command_result *do_getroutes(struct command *cmd,
take(capacities),
info->dev_algo == ALGO_SINGLE_PATH,
deadline, srcnode, dstnode, info->amount,
info->maxfee, info->finalcltv, info->maxdelay, info->maxparts,
info->maxfee,
info->finalcltv,
info->maxdelay,
info->maxparts,
info->maxhops,
include_fees,
cmd->idstr, cmd->filter,
include_next_node_id,
Expand Down Expand Up @@ -900,14 +905,14 @@ static struct command_result *json_getroutes(struct command *cmd,
/* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */
const u32 maxdelay_allowed = 2016;
struct askrene *askrene = get_askrene(cmd->plugin);
const u32 default_maxparts = 100;
const u32 default_maxparts = 100, default_maxhops = 100;
struct getroutes_info *info = tal(cmd, struct getroutes_info);
/* param functions require pointers */
struct node_id *source, *dest;
struct amount_msat *amount, *maxfee;
u32 *finalcltv, *maxdelay;
enum algorithm *dev_algo;
u32 *maxparts;
u32 *maxparts, *maxhops;

if (!param_check(cmd, buffer, params,
p_req("source", param_node_id, &source),
Expand All @@ -920,6 +925,8 @@ static struct command_result *json_getroutes(struct command *cmd,
maxdelay_allowed),
p_opt_def("maxparts", param_u32, &maxparts,
default_maxparts),
p_opt_def("maxhops", param_u32, &maxhops,
default_maxhops),
p_opt_dev("dev_algorithm", param_algorithm,
&dev_algo, ALGO_DEFAULT),
NULL))
Expand Down Expand Up @@ -961,6 +968,7 @@ static struct command_result *json_getroutes(struct command *cmd,
info->dev_algo = *dev_algo;
info->additional_costs = new_htable(info, additional_cost_htable);
info->maxparts = *maxparts;
info->maxhops = *maxhops;

if (askrene->num_live_requests >= askrene->max_children) {
cmd_log(tmpctx, cmd, LOG_INFORM,
Expand Down
11 changes: 7 additions & 4 deletions plugins/askrene/child/child.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,11 @@ void run_child(const struct gossmap *gossmap,
const struct gossmap_node *srcnode,
const struct gossmap_node *dstnode,
struct amount_msat amount, struct amount_msat maxfee,
u32 finalcltv, u32 maxdelay, size_t maxparts,
bool include_fees,
u32 finalcltv,
u32 maxdelay,
size_t maxparts,
u32 maxhops,
bool include_fees,
const char *cmd_id,
struct json_filter *cmd_filter,
bool include_next_node_id,
Expand All @@ -243,11 +246,11 @@ void run_child(const struct gossmap *gossmap,
if (single_path) {
err = single_path_routes(rq, rq, deadline, srcnode, dstnode,
amount, maxfee, finalcltv,
maxdelay, &flows, &probability, &ecode);
maxdelay, maxhops, &flows, &probability, &ecode);
} else {
err = default_routes(rq, rq, deadline, srcnode, dstnode,
amount, maxfee, finalcltv, maxdelay,
maxparts, &flows, &probability, &ecode);
maxparts, maxhops, &flows, &probability, &ecode);
}
if (err) {
write_all(replyfd, &ecode, sizeof(ecode));
Expand Down
5 changes: 4 additions & 1 deletion plugins/askrene/child/child.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ void run_child(const struct gossmap *gossmap,
const struct gossmap_node *srcnode,
const struct gossmap_node *dstnode,
struct amount_msat amount, struct amount_msat maxfee,
u32 finalcltv, u32 maxdelay, size_t maxparts,
u32 finalcltv,
u32 maxdelay,
size_t maxparts,
u32 maxhops,
bool include_fees,
const char *cmd_id,
struct json_filter *cmd_filter,
Expand Down
11 changes: 11 additions & 0 deletions plugins/askrene/child/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ u64 flows_worst_delay(struct flow **flows)
return maxdelay;
}

u32 flows_worst_length(struct flow **flows)
{
u32 maxlen = 0;
for (size_t i = 0; i < tal_count(flows); i++) {
u32 len = tal_count(flows[i]->path);
if (len > maxlen)
maxlen = len;
}
return maxlen;
}

const char *fmt_flows_step_scid(const tal_t *ctx,
const struct route_query *rq,
const struct flow *flow, size_t i)
Expand Down
3 changes: 3 additions & 0 deletions plugins/askrene/child/flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ u64 flow_delay(const struct flow *flow);
/* Max CLTV any of these flows requires */
u64 flows_worst_delay(struct flow **flows);

/* Max number of hops any of these flows requires */
u32 flows_worst_length(struct flow **flows);

const char *fmt_flows_step_scid(const tal_t *ctx,
const struct route_query *rq,
const struct flow *flow, size_t i);
Expand Down
Loading
Loading