github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/test/p2p/fast_sync/check_peer.sh (about) 1 #! /bin/bash 2 set -eu 3 set -o pipefail 4 5 IPV=$1 6 ID=$2 7 8 ########################################### 9 # 10 # Wait for peer to catchup to other peers 11 # 12 ########################################### 13 14 addr=$(test/p2p/address.sh $IPV $ID 26657) 15 peerID=$(( $(($ID % 4)) + 1 )) # 1->2 ... 3->4 ... 4->1 16 peer_addr=$(test/p2p/address.sh $IPV $peerID 26657) 17 18 # get another peer's height 19 h1=`curl -s $peer_addr/status | jq .result.sync_info.latest_block_height | jq fromjson` 20 21 # get another peer's state 22 root1=`curl -s $peer_addr/status | jq .result.sync_info.latest_app_hash` 23 24 echo "Other peer is on height $h1 with state $root1" 25 echo "Waiting for peer $ID to catch up" 26 27 # wait for it to sync to past its previous height 28 set +e 29 set +o pipefail 30 h2="0" 31 while [[ "$h2" -lt "$(($h1+3))" ]]; do 32 sleep 1 33 h2=`curl -s $addr/status | jq .result.sync_info.latest_block_height | jq fromjson` 34 echo "... $h2" 35 done 36 37 # check the app hash 38 root2=`curl -s $addr/status | jq .result.sync_info.latest_app_hash` 39 40 if [[ "$root1" != "$root2" ]]; then 41 echo "App hash after fast sync does not match. Got $root2; expected $root1" 42 exit 1 43 fi 44 echo "... fast sync successful"