lncli-web
lncli-web copied to clipboard
Pay using specific channel
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.
Definitely an interesting feature to have.
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.
Basic sendtoroute feature has been implemented.
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.
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).
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: https://github.com/lightningnetwork/lnd/issues/1603