diff --git a/routing/pathfind.go b/routing/pathfind.go index b9c6cf48..44c0cb99 100644 --- a/routing/pathfind.go +++ b/routing/pathfind.go @@ -75,6 +75,10 @@ func computeFee(amt btcutil.Amount, edge *ChannelHop) btcutil.Amount { // isSamePath returns true if path1 and path2 travel through the exact same // edges, and false otherwise. func isSamePath(path1, path2 []*ChannelHop) bool { + if len(path1) != len(path2) { + return false + } + for i := 0; i < len(path1); i++ { if path1[i].ChannelID != path2[i].ChannelID { return false diff --git a/routing/router_test.go b/routing/router_test.go index b965916e..9b363fdc 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -130,8 +130,8 @@ func TestFindRoutesFeeSorting(t *testing.T) { // Exactly, two such paths should be found. if len(routes) != 2 { - t.Fatalf("2 routes shouldn't been selected, instead %v were: ", - len(routes)) + t.Fatalf("2 routes shouldn't been selected, instead %v were: %v", + len(routes), spew.Sdump(routes)) } // The paths should properly be ranked according to their total fee