Last active
February 22, 2019 02:53
-
-
Save pbostrom/5ea123b8128a881972a0b9cb371df1b8 to your computer and use it in GitHub Desktop.
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
block_age() { | |
bt=$(date -d "$1" +%s) | |
now=$(date +%s) | |
echo $(( $now - $bt )) | |
} | |
status=$(curl -s http://localhost:46657/status) | |
addr=$(echo $status | jq -r ".result.validator_info.address") | |
lbh=$(echo $status | jq -r ".result.sync_info.latest_block_height") | |
lbt=$(echo $status | jq -r ".result.sync_info.latest_block_time") | |
ba=$(block_age $lbt) | |
echo "Latest block height: $lbh" | |
echo "Latest block age: $ba seconds" | |
echo "Validator address: $addr" | |
precommit=$(curl -s http://localhost:46657/block?height=$lbh | jq -r ".result.block.last_commit.precommits | .[] | select(.validator_address==\"$addr\")") | |
echo "Precommit: $precommit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment