lnrpc: allow pubkey in SendToRoute#1944
Conversation
af39bad to
73902e8
Compare
wpaulino
left a comment
There was a problem hiding this comment.
Cool change! We should add a godoc to each of the existing and new methods.
73902e8 to
758638a
Compare
|
|
There was a problem hiding this comment.
Regarding commit structure: it looks like this change (extracting logic into unmarshallHopByChannelLookup) could be done in an individual commit.
There was a problem hiding this comment.
I think I would prefer this check be done inside the unmarshal method. Shouldn't be a problem passing in the graph even though it might not be needed.
There was a problem hiding this comment.
My goal was to have a version of unmarshall that does not have that dependency. I refactored it into a form that satisfies both our requirements.
There was a problem hiding this comment.
I think this comment belongs by the definition of the PubKey field.
758638a to
386738d
Compare
386738d to
b2c8bfa
Compare
|
Comments processed |
There was a problem hiding this comment.
I thought so too, but this is what gofmt does.
There was a problem hiding this comment.
Maybe this works?
PubKey: hex.EncodeToString(
hop.PubKeyBytes[:],
),
}There was a problem hiding this comment.
prevNodePubKey should be made [33]byte
There was a problem hiding this comment.
Why? This way there is less byte copying.
There was a problem hiding this comment.
It makes the length clear, and makes sure it is non-nil. I don't think any extra byte copying makes a difference in this case.
There was a problem hiding this comment.
Changed. Not sure it was worth it. It is a minor thing which to me is also a matter of preference.
By passing a pubkey into SendToRoute, it becomes unnecessary for lnd to query the channel graph to retrieve the hop pubkey. This allows routes over private channels that are not present in the graph.
b2c8bfa to
28ae028
Compare
The information in the
RouteRPC message is not enough to directly send out the payment. First the local channel graph needs to be queried to complete the data. A lookup is executed to retrieve the public key of a node based on channel id. This does not work with private channels.In this PR, we allow the hop pubkeys to be passed in so that execution of the payment becomes independent of the channel graph.
It is also a step towards the unbundling of lnd. (maybe, in the future, we get a node that doesn't track the channel graph at all anymore and is just a payment executor. mobile maybe?)
Fixes #2139.