routing: distinguish between receiver amount and total amount in newRoute
This commit is contained in:
parent
e5c7e9a38c
commit
46f5fc7400
@ -74,6 +74,7 @@ type edgePolicyWithSource struct {
|
|||||||
// custom records and payment address.
|
// custom records and payment address.
|
||||||
type finalHopParams struct {
|
type finalHopParams struct {
|
||||||
amt lnwire.MilliSatoshi
|
amt lnwire.MilliSatoshi
|
||||||
|
totalAmt lnwire.MilliSatoshi
|
||||||
cltvDelta uint16
|
cltvDelta uint16
|
||||||
records record.CustomSet
|
records record.CustomSet
|
||||||
paymentAddr *[32]byte
|
paymentAddr *[32]byte
|
||||||
@ -177,7 +178,8 @@ func newRoute(sourceVertex route.Vertex,
|
|||||||
// Otherwise attach the mpp record if it exists.
|
// Otherwise attach the mpp record if it exists.
|
||||||
if finalHop.paymentAddr != nil {
|
if finalHop.paymentAddr != nil {
|
||||||
mpp = record.NewMPP(
|
mpp = record.NewMPP(
|
||||||
finalHop.amt, *finalHop.paymentAddr,
|
finalHop.totalAmt,
|
||||||
|
*finalHop.paymentAddr,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1327,6 +1327,7 @@ func TestNewRoute(t *testing.T) {
|
|||||||
sourceVertex, testCase.hops, startingHeight,
|
sourceVertex, testCase.hops, startingHeight,
|
||||||
finalHopParams{
|
finalHopParams{
|
||||||
amt: testCase.paymentAmount,
|
amt: testCase.paymentAmount,
|
||||||
|
totalAmt: testCase.paymentAmount,
|
||||||
cltvDelta: finalHopCLTV,
|
cltvDelta: finalHopCLTV,
|
||||||
records: nil,
|
records: nil,
|
||||||
paymentAddr: testCase.paymentAddr,
|
paymentAddr: testCase.paymentAddr,
|
||||||
|
@ -196,6 +196,7 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
|
|||||||
sourceVertex, path, height,
|
sourceVertex, path, height,
|
||||||
finalHopParams{
|
finalHopParams{
|
||||||
amt: maxAmt,
|
amt: maxAmt,
|
||||||
|
totalAmt: maxAmt,
|
||||||
cltvDelta: finalCltvDelta,
|
cltvDelta: finalCltvDelta,
|
||||||
records: p.payment.DestCustomRecords,
|
records: p.payment.DestCustomRecords,
|
||||||
paymentAddr: p.payment.PaymentAddr,
|
paymentAddr: p.payment.PaymentAddr,
|
||||||
|
@ -1456,6 +1456,7 @@ func (r *ChannelRouter) FindRoute(source, target route.Vertex,
|
|||||||
source, path, uint32(currentHeight),
|
source, path, uint32(currentHeight),
|
||||||
finalHopParams{
|
finalHopParams{
|
||||||
amt: amt,
|
amt: amt,
|
||||||
|
totalAmt: amt,
|
||||||
cltvDelta: finalExpiry,
|
cltvDelta: finalExpiry,
|
||||||
records: destCustomRecords,
|
records: destCustomRecords,
|
||||||
},
|
},
|
||||||
@ -2513,6 +2514,7 @@ func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi,
|
|||||||
source, pathEdges, uint32(height),
|
source, pathEdges, uint32(height),
|
||||||
finalHopParams{
|
finalHopParams{
|
||||||
amt: receiverAmt,
|
amt: receiverAmt,
|
||||||
|
totalAmt: receiverAmt,
|
||||||
cltvDelta: uint16(finalCltvDelta),
|
cltvDelta: uint16(finalCltvDelta),
|
||||||
records: nil,
|
records: nil,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user