routing+lnrpc: extend BuildRoute to accept raw payAddr

In this commit, we extend the `BuildRoute` method and RPC on the router
sub-server to accept a raw payment address which will be included as
part of an MPP payload for the finla hop. This change actually also
allows users to craft their own MPP paths using BuildRoute+SendToRoute.
Our primary goal however, was to fix some broken itests since we now
require the payAddr to be present for ALL payments other than key send
payments.
This commit is contained in:
Olaoluwa Osuntokun committed 2020-11-25 16:32:02 -08:00
1 parent 530059f18b
commit d996607470
7 files changed
+272 -201

No files matched your search

+9 -1
View File
@@ -564,9 +564,17 @@ func (s *Server) BuildRoute(ctx context.Context,
outgoingChan = &req.OutgoingChanId
}
var payAddr *[32]byte
if len(req.PaymentAddr) != 0 {
var backingPayAddr [32]byte
copy(backingPayAddr[:], req.PaymentAddr)
payAddr = &backingPayAddr
}
// Build the route and return it to the caller.
route, err := s.cfg.Router.BuildRoute(
amt, hops, outgoingChan, req.FinalCltvDelta,
amt, hops, outgoingChan, req.FinalCltvDelta, payAddr,
)
if err != nil {
return nil, err