Skip to content

Instantly share code, notes, and snippets.

@ryssroad
Created July 14, 2022 21:56
Show Gist options
  • Save ryssroad/e6936d2615feef5affbef23c66da48f3 to your computer and use it in GitHub Desktop.
Save ryssroad/e6936d2615feef5affbef23c66da48f3 to your computer and use it in GitHub Desktop.
icad statesync
sudo systemctl stop icad.service
icad tendermint unsafe-reset-all --home ~/.ica/
SNAP_RPC1="http://157.90.179.182:28657" \
&& SNAP_RPC2="http://157.90.179.182:28657"
LATEST_HEIGHT=$(curl -s $SNAP_RPC2/block | jq -r .result.block.header.height) \
&& BLOCK_HEIGHT=$((LATEST_HEIGHT - 300)) \
&& TRUST_HASH=$(curl -s "$SNAP_RPC2/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC1,$SNAP_RPC2\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.ica/config/config.toml
peers="3df77e9140b74b84e9d19040956acfe364fbb41a@157.90.179.182:28656" \
&& sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.ica/config/config.toml
sudo systemctl restart icad.service && sudo journalctl -u icad.service -f -o cat
#Use command below to switch off your State Sync mode, after node fully synced to avoid problems in future node restarts!
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1false|" $HOME/.ica/config/config.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment