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 committed 2022-12-12 13:19:29 +01:00
1 parent d9febbb9fc
commit 7d29ab905c
4 files changed
+23 -19

No files matched your search

+5 -4
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.