From 3d37e080853c880fe56aeee958be6d9a1d61600c Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Wed, 22 Sep 2021 14:19:25 +0300 Subject: [PATCH] Sort the results of queryRandom in best-to-worst order --- beacon_chain/networking/eth2_network.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index d4df6738c..1446d3c0f 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -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