routing: track unifiedPolicyEdge

Preparation so that we can have the inbound fee available
in addition to the outgoing policy.
This commit is contained in:
Joost Jager
2022-09-03 13:59:10 +02:00
parent a6d4bb5c89
commit e0a080454a
6 changed files with 64 additions and 51 deletions

View File

@@ -3218,14 +3218,14 @@ func getRouteUnifiers(source route.Vertex, hops []route.Vertex,
// including fees, to send the payment.
func getPathEdges(source route.Vertex, receiverAmt lnwire.MilliSatoshi,
unifiers []*edgeUnifier, bandwidthHints *bandwidthManager,
hops []route.Vertex) ([]*models.CachedEdgePolicy,
hops []route.Vertex) ([]*unifiedEdge,
lnwire.MilliSatoshi, error) {
// Now that we arrived at the start of the route and found out the route
// total amount, we make a forward pass. Because the amount may have
// been increased in the backward pass, fees need to be recalculated and
// amount ranges re-checked.
var pathEdges []*models.CachedEdgePolicy
var pathEdges []*unifiedEdge
for i, unifier := range unifiers {
edge := unifier.getEdge(receiverAmt, bandwidthHints)
if edge == nil {
@@ -3247,7 +3247,7 @@ func getPathEdges(source route.Vertex, receiverAmt lnwire.MilliSatoshi,
)
}
pathEdges = append(pathEdges, edge.policy)
pathEdges = append(pathEdges, edge)
}
return pathEdges, receiverAmt, nil