Created
July 14, 2022 21:56
-
-
Save ryssroad/e6936d2615feef5affbef23c66da48f3 to your computer and use it in GitHub Desktop.
icad statesync
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
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