-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run localnet on every commit ensure network reaches at least 10 blocks (
- Loading branch information
1 parent
3d50567
commit 45bd414
Showing
5 changed files
with
79 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
CNT=0 | ||
ITER=$1 | ||
SLEEP=$2 | ||
NUMBLOCKS=$3 | ||
NODEADDR=$4 | ||
|
||
if [ -z "$1" ]; then | ||
echo "Need to input number of iterations to run..." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ]; then | ||
echo "Need to input number of seconds to sleep between iterations" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$3" ]; then | ||
echo "Need to input block height to declare completion..." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$4" ]; then | ||
echo "Need to input node address to poll..." | ||
exit 1 | ||
fi | ||
|
||
while [ ${CNT} -lt $ITER ]; do | ||
var=$(curl -s $NODEADDR:26657/status | jq -r '.result.sync_info.latest_block_height') | ||
echo "Number of Blocks: ${var}" | ||
if [ ! -z ${var} ] && [ ${var} -gt ${NUMBLOCKS} ]; then | ||
echo "Number of blocks reached, exiting success..." | ||
exit 0 | ||
fi | ||
let CNT=CNT+1 | ||
sleep $SLEEP | ||
done | ||
|
||
echo "Timeout reached, exiting failure..." | ||
exit 1 |