Added: Adding a needed_features optional parameter to the getroutes command#8816
Added: Adding a needed_features optional parameter to the getroutes command#881621M4TW wants to merge 1 commit intoElementsProject:masterfrom
Conversation
getroutes command so a route involving only nodes having the needed features can be found.
| default_maxparts), | ||
| p_opt_dev("dev_algorithm", param_algorithm, | ||
| &dev_algo, ALGO_DEFAULT), | ||
| p_opt_def("needed_features", param_u64, &needed_features, |
There was a problem hiding this comment.
There are already features > 64, so this needs to be an array of u16. It also goes before the dev_ flags (they're not part of the API, so they always go last).
There was a problem hiding this comment.
I might suggest that we use odd and even feature numbers here. So odd means "if we don't have a node_announcement for the node, assume it has the feature" and even means "if we don't have a node_announcement, assume it doesn't have the feature".
Also, rename to "node_features": there are also channel features in theory, and we might support those in future.
There was a problem hiding this comment.
I was using a 64-bit field since CLN seemed to be only using 64-bit elsewhere in the code base and it was a more efficient implementation for node_has_needed_features (not having to parse all bytes) if only testing for features supported by CLN, but if the additional overhead is not an issue I could implement it with u16. It would make the functionality more generic and I could add support for odd and even feature numbers.
There was a problem hiding this comment.
The spec already contains features > 63, so we need to be future proof. In fact splicing is 163, because we're using a temporary experimental number.
Thanks!
| { | ||
| const u32 node_id = gossmap_node_idx(gossmap,node); | ||
|
|
||
| if (!node_has_needed_features(gossmap, node, params->needed_features)) goto next; |
There was a problem hiding this comment.
This should be "continue;" not "goto next;".
| node = gossmap_next_node(gossmap, node)) { | ||
| const u32 node_id = gossmap_node_idx(gossmap, node); | ||
|
|
||
| if (!node_has_needed_features(gossmap, node, params->needed_features)) goto next; |
Adding a needed_features optional parameter to the getroutes command so a route involving only nodes having the needed features can be found. This is useful to find Bolt12 offer paths, for example.
Important
26.04 FREEZE March 11th: Non-bugfix PRs not ready by this date will wait for 26.06.
RC1 is scheduled on March 23rd
The final release is scheduled for April 15th.
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:
tools/lightning-downgrade