diff --git a/routing/pathfind.go b/routing/pathfind.go index 5507444a..b6879cc6 100644 --- a/routing/pathfind.go +++ b/routing/pathfind.go @@ -74,6 +74,7 @@ type edgePolicyWithSource struct { // custom records and payment address. type finalHopParams struct { amt lnwire.MilliSatoshi + totalAmt lnwire.MilliSatoshi cltvDelta uint16 records record.CustomSet paymentAddr *[32]byte @@ -177,7 +178,8 @@ func newRoute(sourceVertex route.Vertex, // Otherwise attach the mpp record if it exists. if finalHop.paymentAddr != nil { mpp = record.NewMPP( - finalHop.amt, *finalHop.paymentAddr, + finalHop.totalAmt, + *finalHop.paymentAddr, ) } } else { diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index 193e752d..ab54534b 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -1327,6 +1327,7 @@ func TestNewRoute(t *testing.T) { sourceVertex, testCase.hops, startingHeight, finalHopParams{ amt: testCase.paymentAmount, + totalAmt: testCase.paymentAmount, cltvDelta: finalHopCLTV, records: nil, paymentAddr: testCase.paymentAddr, diff --git a/routing/payment_session.go b/routing/payment_session.go index a28f6a6f..9f9c347c 100644 --- a/routing/payment_session.go +++ b/routing/payment_session.go @@ -196,6 +196,7 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi, sourceVertex, path, height, finalHopParams{ amt: maxAmt, + totalAmt: maxAmt, cltvDelta: finalCltvDelta, records: p.payment.DestCustomRecords, paymentAddr: p.payment.PaymentAddr, diff --git a/routing/router.go b/routing/router.go index c554ceee..7d80305b 100644 --- a/routing/router.go +++ b/routing/router.go @@ -1456,6 +1456,7 @@ func (r *ChannelRouter) FindRoute(source, target route.Vertex, source, path, uint32(currentHeight), finalHopParams{ amt: amt, + totalAmt: amt, cltvDelta: finalExpiry, records: destCustomRecords, }, @@ -2513,6 +2514,7 @@ func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi, source, pathEdges, uint32(height), finalHopParams{ amt: receiverAmt, + totalAmt: receiverAmt, cltvDelta: uint16(finalCltvDelta), records: nil, },