routing: return *unifiedPolicyEdge in getPolicy

We encapsulate the capacity inside a unifiedPolicyEdge for later usage.
The meaning of "policy" has changed now, which will be refactored in the
next commmit.
This commit is contained in:
bitromortac
2022-09-30 09:03:27 +02:00
parent d9febbb9fc
commit 7d29ab905c
4 changed files with 23 additions and 19 deletions

View File

@@ -2837,10 +2837,11 @@ func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi,
// Add fee for this hop.
if !localChan {
runningAmt += policy.ComputeFee(runningAmt)
runningAmt += policy.policy.ComputeFee(runningAmt)
}
log.Tracef("Select channel %v at position %v", policy.ChannelID, i)
log.Tracef("Select channel %v at position %v",
policy.policy.ChannelID, i)
edges[i] = unifiedPolicy
}
@@ -2862,12 +2863,12 @@ func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi,
if i > 0 {
// Decrease the amount to send while going forward.
receiverAmt -= policy.ComputeFeeFromIncoming(
receiverAmt -= policy.policy.ComputeFeeFromIncoming(
receiverAmt,
)
}
pathEdges = append(pathEdges, policy)
pathEdges = append(pathEdges, policy.policy)
}
// Build and return the final route.