From e47160d257760748838328944470f834ca5026c1 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Wed, 7 Aug 2024 16:51:09 +0200 Subject: [PATCH] routing: fix MC probability order for blinded paths Fix the blinded path probability sorting function. Also fix the test assertion function. --- routing/router.go | 2 +- routing/router_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routing/router.go b/routing/router.go index 4169548c5..b5bca5d7c 100644 --- a/routing/router.go +++ b/routing/router.go @@ -746,7 +746,7 @@ func (r *ChannelRouter) FindBlindedPaths(destination route.Vertex, // Sort the routes based on probability. sort.Slice(routes, func(i, j int) bool { - return routes[i].probability < routes[j].probability + return routes[i].probability > routes[j].probability }) // Now just choose the best paths up until the maximum number of allowed diff --git a/routing/router_test.go b/routing/router_test.go index 3a9b97d29..fb02024d2 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -3150,7 +3150,7 @@ func TestFindBlindedPathsWithMC(t *testing.T) { } for i, path := range expectedPaths { - require.Equal(t, expectedPaths[i], path) + require.Equal(t, path, actualPaths[i]) } }