lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.67k stars 2.07k forks source link

Add a SendToRoute RPC command #188

Closed Roasbeef closed 6 years ago

Roasbeef commented 7 years ago

Currently, the only way to send a payment using lnd is to default to the daemon's default path finding and ranking algorithms. It may be the case that a higher level application has additional context, which must be accounted for when sending payments.

A command should be added which allows for "route control", meaning the user explicitly defines the entirety of the route to be used to dispatch a particular payment. Once this issue is complete, the following command chain should be possible (or something similar to it):

$ lncli queryroutes --dest=<pubkey> --amt<amt> | lncli sendtoroute - 

Steps To Completion

afederigo commented 7 years ago

Could I take this task? Is it still free?

Roasbeef commented 7 years ago

@afederigo AFAIK now no one is currently working on this issue. So it's all yours!

afederigo commented 7 years ago

Ok, I will try to resolve it.

t4sk commented 6 years ago

@afederigo are you still working on this? if not, i would like to try to finish it.

Roasbeef commented 6 years ago

Worth noting that @cfromknecht's atomic swap branch adopted this PR as has a mostly complete implementation. So transferring the work he's done there into a new PR would be an excellent addition.

afederigo commented 6 years ago

Hello guys! As of July, this branch had a complete logic. But currently I am very busy in the main job and I am not able to support your project (hope temporarily). Do as you see fit.

t4sk commented 6 years ago

@afederigo Thanks for your contribution! I will try to finish this one.

Roasbeef commented 6 years ago

@t4sk check out this branch: https://github.com/cfromknecht/lnd/commits/swapz

It has a mostly finished implementation. So the remaining work would be to port it back over to the current codebase, as some things have changed since that branch was created.

t4sk commented 6 years ago

Hi @Roasbeef

I am writing some integration tests for lnd_test.go.

In the previous PR @AndrewSamokhvalov mentions that we can test multihop payments through a route by creating a channel between Alice and Bob and then sending a payment to an unknown receiver.

From my understanding, you need to have a channel open in order to receive a payment. If the receiver has a channel open then he is known. If he is unknown then he doesn't have a channel open to receive payments. So how would I setup a test to send a payment to this unknown receiver?

Thanks in advance

afederigo commented 6 years ago

Hi, @t4sk You could use tests I wrote. As far as I remember they were accepted by Andrew.

Roasbeef commented 6 years ago

@t4sk are you working off of @cfromknecht's branch? (`swapz)

You can look at the existing multi-hop integration test, and either add a new scenario, or write a new test entirely.

t4sk commented 6 years ago

@afederigo Thanks I had a look at it. I will include it. But I think I need to write few more tests since SendToRoute does not call SendToPayment.

@Roasbeef I did, ported most of the relevant code. Thanks I will take a look at the multi-hop test.

Roasbeef commented 6 years ago

Fixed by #747.