routing: consolidate final hop params for newRoute

This commit creates a wrapper struct, grouping all parameters that
influence the final hop during route construction. This is a preliminary
step for passing in the receiver's invoice feature bits, which will be
used to select an appropriate payment or payload type.
This commit is contained in:
Conner Fromknecht
2019-12-18 23:55:08 -08:00
parent 71e05e05bf
commit 495ae8ca42
4 changed files with 79 additions and 32 deletions

View File

@ -1454,8 +1454,12 @@ func (r *ChannelRouter) FindRoute(source, target route.Vertex,
// Create the route with absolute time lock values.
route, err := newRoute(
amt, source, path, uint32(currentHeight), finalCLTVDelta,
destCustomRecords,
source, path, uint32(currentHeight),
finalHopParams{
amt: amt,
cltvDelta: finalCLTVDelta,
records: destCustomRecords,
},
)
if err != nil {
return nil, err
@ -2403,7 +2407,11 @@ func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi,
}
return newRoute(
receiverAmt, source, pathEdges, uint32(height),
uint16(finalCltvDelta), nil,
source, pathEdges, uint32(height),
finalHopParams{
amt: receiverAmt,
cltvDelta: uint16(finalCltvDelta),
records: nil,
},
)
}