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

Pay using specific channel #156

Open
halfik opened this issue Jul 20, 2018 · 5 comments
Open

Pay using specific channel #156

halfik opened this issue Jul 20, 2018 · 5 comments

Comments

@halfik
Copy link

halfik commented Jul 20, 2018

I took me some time to find how to do this but its there.
lncli sendtoroute

Thing is this is very hard to do with cli. Would be nice to have option here in web UI.
First we need to decode invoice with decodepayreq to get payment hash and destination.

Then we need to query routes with destination and amount.
Based on result we can allow user to chose channel (each first hop of returns routes is our channel).

Wit all of this we can use sendtoroute - pay using out selected channel.

This would be cool feature becouse it allows to keep channels balanced (dunno if it can be used to move sat from one own channel to another). LND by default i think always chose first route we can see when query routes - cheapest and shortes. And its bad if you want keep all channels properly balances for routing.

@mably
Copy link
Owner

mably commented Jul 20, 2018

Definitely an interesting feature to have.

@halfik
Copy link
Author

halfik commented Jul 21, 2018

Here is how it works for me with CLI:

lncli queryroutes DEST AMT --num_max_routes 1 --final_cltv_delta=144 | lncli sendtoroute --pay_hash=PAY_HASH -

Thing is final cltv delta has to be 144. Dunno why exacly. But with out it most of times i tried it didnt work. not sure if its becouse destination has Time Lock Delta set into 144 or what. But probably it is the case.

@mably
Copy link
Owner

mably commented Jul 22, 2018

Basic sendtoroute feature has been implemented.

image

Payment hashes have also been added to the invoices list so you can copy/paste them in the "Send to route" dialog.

Route(s) can be copy/pasted from the "Query routes" dialog results.

@halfik
Copy link
Author

halfik commented Jul 23, 2018

Yep its working :)
Now we need good UI for it and its going to be awsome to keep channels balanced.
Now we should test this queryroutes param "final_cltv_delta". I think we can use route thought nodes that have same value as we do on our channels. I was checking random nodes 2 days ago and it seems that most of nodes use 144 (lnd default) but there is a lot with 14 (i think this are c-lightning nodes).

@halfik
Copy link
Author

halfik commented Jul 23, 2018

I have tired to use it to send from one channel to another, but it can't be done ;p
But i found that there is a PR that should allow to do this: lightningnetwork/lnd#1603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants