Merge pull request #3819 from joostjager/fix-custom-record-payment

multi: fix custom record payment
This commit is contained in:
Joost Jager
2019-12-12 14:33:05 +01:00
committed by GitHub
23 changed files with 447 additions and 204 deletions

View File

@@ -50,11 +50,11 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/macaroons"
"github.com/lightningnetwork/lnd/monitoring"
"github.com/lightningnetwork/lnd/record"
"github.com/lightningnetwork/lnd/routing"
"github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/signal"
"github.com/lightningnetwork/lnd/sweep"
"github.com/lightningnetwork/lnd/tlv"
"github.com/lightningnetwork/lnd/watchtower"
"github.com/lightningnetwork/lnd/zpay32"
"github.com/tv42/zbase32"
@@ -3103,7 +3103,7 @@ type rpcPaymentIntent struct {
lastHop *route.Vertex
payReq []byte
destTLV []tlv.Record
destCustomRecords record.CustomSet
route *route.Route
}
@@ -3162,12 +3162,13 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
}
payIntent.cltvLimit = cltvLimit
payIntent.destTLV, err = routerrpc.UnmarshallCustomRecords(
err = routerrpc.ValidateCustomRecords(
rpcPayReq.DestCustomRecords,
)
if err != nil {
return payIntent, err
}
payIntent.destCustomRecords = rpcPayReq.DestCustomRecords
validateDest := func(dest route.Vertex) error {
if rpcPayReq.AllowSelfPayment {
@@ -3352,7 +3353,7 @@ func (r *rpcServer) dispatchPaymentIntent(
LastHop: payIntent.lastHop,
PaymentRequest: payIntent.payReq,
PayAttemptTimeout: routing.DefaultPayAttemptTimeout,
FinalDestRecords: payIntent.destTLV,
DestCustomRecords: payIntent.destCustomRecords,
}
preImage, route, routerErr = r.server.chanRouter.SendPayment(