sudo systemctl stop tacchaind
cp $HOME/.tacchaind/data/priv_validator_state.json $HOME/.tacchaind/priv_validator_state.json.backup
tacchaind tendermint unsafe-reset-all --home $HOME/.tacchaind --keep-addr-book
SYNC_RPC="https://rpc-test.tacchain.vinjan.xyz"
SYNC_PEER="c51c2c495f95c6270324e99808b7a44ec471dbfe@88.99.149.170:31656"
LATEST_HEIGHT=$(curl -s $SYNC_RPC/block | jq -r .result.block.header.height)
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000))
TRUST_HASH=$(curl -s "$SYNC_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
sed -i \
-e "s|^enable *=.*|enable = true|" \
-e "s|^rpc_servers *=.*|rpc_servers = \"$SYNC_RPC,$SYNC_RPC\"|" \
-e "s|^trust_height *=.*|trust_height = $BLOCK_HEIGHT|" \
-e "s|^trust_hash *=.*|trust_hash = \"$TRUST_HASH\"|" \
-e "s|^persistent_peers *=.*|persistent_peers = \"$SYNC_PEER\"|" \
$HOME/.tacchaind/config/config.toml
mv $HOME/.tacchaind/priv_validator_state.json.backup $HOME/.tacchaind/data/priv_validator_state.json
sudo systemctl restart tacchaind
sudo journalctl -u tacchaind -f -o cat