From 87a0cb16032e8cfeca249e5ff04439238ae5d943 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Wed, 28 Dec 2022 08:44:19 +0100 Subject: [PATCH] Replace head -n with sort -R for better random peer selection --- contrib/bootstrap-node.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/bootstrap-node.sh b/contrib/bootstrap-node.sh index 13c26eae9..ae648b99f 100755 --- a/contrib/bootstrap-node.sh +++ b/contrib/bootstrap-node.sh @@ -47,8 +47,7 @@ fi # IPV4: 03ee180e8ee07f1f9c9987d98b5d5decf6bad7d058bdd8be3ad97c8e0dd2cdc7ba@85.214.212.104 # IPV4: 03f2d334ab70d50623c889400941dc80874f38498e7d09029af0f701d7089aa516@158.174.131.171 -NUM=$(grep -c '^# IPV4:' "$0") -PEERS=$(grep '^# IPV4:' "$0" | head -n $(($(date +%s) % (NUM - 3) )) | tail -n 3 | cut -d' ' -f3-) +PEERS=$(grep '^# IPV4:' "$0" | sort -R | tail -n 3 | cut -d' ' -f3-) for p in $PEERS; do echo "Trying to connect to random peer $p..."