routing: ensure we set the TotalFees value on routes properly
Before this commit, we wouldn’t properly set the TotalFees attribute. As a result, our sorting algorithm at the end to select candidate routes would simply maintain the time-lock order rather than also sort by total fees. This commit fixes this issue and also allows the test added in the prior commit to pass.
This commit is contained in:
parent
4444ec39ea
commit
7a3116f8a9
@ -302,6 +302,8 @@ func newRoute(amtToSend lnwire.MilliSatoshi, sourceVertex Vertex,
|
||||
}
|
||||
edge.Node.PubKey.Curve = nil
|
||||
|
||||
route.TotalFees += nextHop.Fee
|
||||
|
||||
// As a sanity check, we ensure that the selected channel has
|
||||
// enough capacity to forward the required amount which
|
||||
// includes the fee dictated at each hop.
|
||||
|
@ -186,7 +186,7 @@ func TestFindRoutesFeeSorting(t *testing.T) {
|
||||
routes[0].TotalFees)
|
||||
}
|
||||
if routes[1].TotalFees == 0 {
|
||||
t.Fatalf("total fees not set in second route: ",
|
||||
t.Fatalf("total fees not set in second route: %v",
|
||||
spew.Sdump(routes[0]))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user