Lnd: Add a SendToRoute RPC command

Created on 14 Apr 2017  路  13Comments  路  Source: lightningnetwork/lnd

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

  • [ ] Define a new SendToRoute RPC command as part of our gRPC service.

    • Some initial sanity checks should be performed to ensure the provided route is valid, and won't result in some invalid state (infinite loop payments).

    • The command should take a _list_ of prospective routes to try to in order to complete the payment itself.

    • Additionally, the payment amount and the payment hash should also be provided.

  • [ ] Implement the SendToRoute command within the daemon itself.
  • [ ] Design an accepted JSON format which makes the above command possible when implementing the sendtoroute cli option.
beginner enhancement gRPC routing rpc

Most helpful comment

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

All 13 comments

Could I take this task? Is it still free?

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

Ok, I will try to resolve it.

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

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.

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.

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

@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.

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

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

@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.

@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.

Fixed by #747.

Was this page helpful?
0 / 5 - 0 ratings