diff --git a/test/p2p/kill_all/check_peers.sh b/test/p2p/kill_all/check_peers.sh index 52dcde91c..37cd13a42 100644 --- a/test/p2p/kill_all/check_peers.sh +++ b/test/p2p/kill_all/check_peers.sh @@ -4,20 +4,20 @@ set -eu NUM_OF_PEERS=$1 # how many attempts for each peer to catch up by height -MAX_ATTEMPTS_TO_CATCH_UP=20 +MAX_ATTEMPTS_TO_CATCH_UP=120 echo "Waiting for nodes to come online" set +e for i in $(seq 1 "$NUM_OF_PEERS"); do - addr=$(test/p2p/ip.sh "$i"):46657 - curl -s "$addr/status" > /dev/null - ERR=$? - while [ "$ERR" != 0 ]; do - sleep 1 - curl -s "$addr/status" > /dev/null - ERR=$? - done - echo "... node $i is up" + addr=$(test/p2p/ip.sh "$i"):46657 + curl -s "$addr/status" > /dev/null + ERR=$? + while [ "$ERR" != 0 ]; do + sleep 1 + curl -s "$addr/status" > /dev/null + ERR=$? + done + echo "... node $i is up" done set -e @@ -28,22 +28,22 @@ echo "1st peer is on height $h1" echo "Waiting until other peers reporting a height higher than the 1st one" for i in $(seq 2 "$NUM_OF_PEERS"); do - attempt=1 - hi=0 + attempt=1 + hi=0 - while [[ $hi -le $h1 ]] ; do - addr=$(test/p2p/ip.sh "$i"):46657 - hi=$(curl -s "$addr/status" | jq .result.latest_block_height) + while [[ $hi -le $h1 ]] ; do + addr=$(test/p2p/ip.sh "$i"):46657 + hi=$(curl -s "$addr/status" | jq .result.latest_block_height) - echo "... peer $i is on height $hi" + echo "... peer $i is on height $hi" - ((attempt++)) - if [ "$attempt" -ge $MAX_ATTEMPTS_TO_CATCH_UP ] ; then - echo "$attempt unsuccessful attempts were made to catch up" - curl -s "$addr/dump_consensus_state" | jq .result - exit 1 - fi + ((attempt++)) + if [ "$attempt" -ge $MAX_ATTEMPTS_TO_CATCH_UP ] ; then + echo "$attempt unsuccessful attempts were made to catch up" + curl -s "$addr/dump_consensus_state" | jq .result + exit 1 + fi - sleep 1 - done + sleep 1 + done done