Skip to content

Commit

Permalink
Boilerplate for active stake cache polling check
Browse files Browse the repository at this point in the history
  • Loading branch information
dostrelith678 committed Jan 9, 2022
1 parent 988c161 commit e66c7aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/grest-helper-scripts/grest-poll.sh
Expand Up @@ -137,6 +137,7 @@ function chk_rpcs() {
function chk_cache_status() {
last_stakedist_block=$(curl -skL "${URL}/control_table?key=eq.stake_distribution_lbh" | jq -r .[0].last_value 2>/dev/null)
last_poolhist_update=$(curl -skL "${URL}/control_table?key=eq.pool_history_cache_last_updated" | jq -r .[0].last_value 2>/dev/null)
last_actvstake_epoch=$(curl -skL "${URL}/control_table?key=eq.last_active_stake_validated_epoch" | jq -r .[0].last_value 2>/dev/null)
if [[ "${last_stakedist_block}" == "" ]] || [[ "${last_stakedist_block}" == "[]" ]] || [[ $(( block_no - last_stakedist_block )) -gt 1000 ]]; then
echo "ERROR: Stake Distribution cache too far from tip !!"
optexit
Expand All @@ -145,6 +146,10 @@ function chk_cache_status() {
echo "ERROR: Pool History cache too far from tip !!"
optexit
fi
if [[ "${last_actvstake_epoch}" == "" ]] || [[ "${last_actvstake_epoch}" == "[]" ]] || [[ "${last_actvstake_epoch}" != "${epoch}" ]]; then
echo "ERROR: Active Stake cache too far from tip !!"
optexit
fi
# TODO: Ensure other cache tables have entry in control table , potentially with last update time
}

Expand Down

0 comments on commit e66c7aa

Please sign in to comment.