Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve routing efficiency by utilizing source_pub_key argument in QueryRoutes #52

Closed
jgwtt opened this issue Apr 15, 2019 · 8 comments
Closed
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jgwtt
Copy link

jgwtt commented Apr 15, 2019

If the FROM channel is specified on the command line, the script should probably call GetRoutes while specifying the source_pub_key argument as the first node in the route (the node on the other end of the FROM channel). Currently, GetRoutes tries to find N routes indiscriminately and the check to match the FROM channel happens after routes are returned. This is inefficient and thus it takes longer to find the suitable route and could result in higher chances of routing failure.

I observed that often the 15/30/.. routes returned by the RPC call do not match the FROM channel and the rebalancing fails for that reason

@C-Otto
Copy link
Owner

C-Otto commented Apr 15, 2019

The source node where the request route should originated from. If empty, self is assumed.

That means, when using source_pub_key, that we have to extend the first hop to that node, and modify every hop due to fees etc.

@jgwtt
Copy link
Author

jgwtt commented Apr 15, 2019

Maybe I am missing something but here is how I picture it.

Suppose a valid rebalancing chain is A->B->...->Z->A and you specify -f AB -t AZ on the command line. I think currently you request routes from A to Z and try to match the first hop to the -f argument (channel AB). However, if you specified source_pub_key=B, won't it find routes from B to Z (you can also blacklist AZ channel if that's a problem) thus finding only the rebalancing routes satisfying the given -f and -t arguments?

@C-Otto
Copy link
Owner

C-Otto commented Apr 16, 2019

You're exactly right. However, the route returned is only going from B to Z, and we need to add the first hop from A to B. This requires us to update the fees along the route, similar to the route extension as it currently happens for the last hop.

@jgwtt
Copy link
Author

jgwtt commented Apr 17, 2019

If it's similar, it should not be hard to implement, do I understand you correctly?

I often see failure to find a route among 45-60 returned routes just because the first hop does not match -f arg

It may become even bigger issue when they depreciate num_routes_to_request argument

@wamde wamde added enhancement New feature or request good first issue Good for newcomers labels Apr 19, 2019
@wamde
Copy link
Collaborator

wamde commented Apr 19, 2019

@jgwtt the GetRoutes call you are mentioning is not a lnd call, is it? Either way, lnd's QueryRoutes now has a source_pub_key parameter, which was just recently added: lightningnetwork/lnd#2572

We should use that when the -f parameter is used, you are right.
Do you want to give it a shot?

@jgwtt
Copy link
Author

jgwtt commented Apr 25, 2019

@wamde let me see if I can get this going

@manreo
Copy link
Contributor

manreo commented Apr 25, 2019

You do need to update the https://github.com/lightningnetwork/lnd/tree/master/lnrpc the rebalance-lnd uses

@C-Otto
Copy link
Owner

C-Otto commented Jun 18, 2019

In the current master I just ignore all channels but the one specified by -f. This is a bit hacked, but it works and I don't see the advantage of having more complicated logic as described above.

@C-Otto C-Otto closed this as completed Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants