Skip to content

Commit

Permalink
relay: fix update client multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
baabeetaa committed Jun 30, 2024
1 parent 26b9aeb commit d1be5d4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions relay/cron/cron_update_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ items=$(curl -s "$URL" |jq -c -r '.[]')

TESTNETS="(testnet|narwhal-2|osmo-test-5|theta-testnet-001)"

UPDATED_CLIENTS=""

echo "$items" | while IFS= read -r item ; do
chain_id=$(echo "$item" |jq -r .chain_id)
client_id=$(echo $item |jq -r .client_id)
Expand Down Expand Up @@ -54,7 +56,14 @@ echo "$items" | while IFS= read -r item ; do

if [[ ${BLOCK_AGE} -gt ${threshold_time} ]]; then
echo "chain_id=$chain_id, channel_id=$channel_id, block_time=$block_time block_time is more than $threshold_time seconds ago => update client."

if [ $( echo $UPDATED_CLIENTS | grep -c "(${chain_id}/${client_id})" ) -ne 0 ]; then
# dont update client again
continue
fi

$HOME/.hermes/bin/hermes update client --host-chain $chain_id --client $client_id
UPDATED_CLIENTS="${UPDATED_CLIENTS}(${chain_id}/${client_id})"
fi
fi
done

0 comments on commit d1be5d4

Please sign in to comment.