Sort the results of queryRandom in best-to-worst order

This commit is contained in:
Zahary Karadjov 2021-09-22 14:19:25 +03:00
parent 02372849f1
commit 3d37e08085
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 1 additions and 1 deletions

View File

@ -946,7 +946,7 @@ proc queryRandom*(
filtered.add((score, n))
d.rng[].shuffle(filtered)
return filtered.sortedByIt(it[0]).mapIt(it[1])
return filtered.sortedByIt(-it[0]).mapIt(it[1])
proc trimConnections(node: Eth2Node, count: int) {.async.} =
# Kill `count` peers, scoring them to remove the least useful ones