github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/scripts/localnet-blocks-test.sh (about)

     1  #!/bin/bash
     2  
     3  ITERATIONS=$1
     4  SLEEP=$2
     5  NUMBLOCKS=$3
     6  NODEADDR=$4
     7  
     8  if [ -z "$1" ]; then
     9    echo "Need to input number of iterations to run..."
    10    exit 1
    11  fi
    12  
    13  if [ -z "$2" ]; then
    14    echo "Need to input number of seconds to sleep between iterations"
    15    exit 1
    16  fi
    17  
    18  if [ -z "$3" ]; then
    19    echo "Need to input block height to declare completion..."
    20    exit 1
    21  fi
    22  
    23  if [ -z "$4" ]; then
    24    echo "Need to input node address to poll..."
    25    exit 1
    26  fi
    27  
    28  I=0
    29  while [ ${I} -lt "$ITERATIONS" ]; do
    30    var=$(curl -s "$NODEADDR:26657/status" | jq -r ".result.sync_info.latest_block_height")
    31    echo "Number of Blocks: ${var}"
    32    if [ ! -z "${var}" ] && [ "${var}" -gt "${NUMBLOCKS}" ]; then
    33      echo "Number of blocks reached, exiting success..."
    34      exit 0
    35    fi
    36  	I=$((I+1))
    37    sleep "$SLEEP"
    38  done
    39  
    40  echo "Timeout reached, exiting failure..."
    41  exit 1