sudo systemctl stop republicd
cp $HOME/.republic/data/priv_validator_state.json $HOME/.republic/priv_validator_state.json.backup
republicd comet unsafe-reset-all --home $HOME/.republic --keep-addr-book
SNAP_RPC="https://rpc-t.republic.vinjan-inc.com:443"
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height)
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000))
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" "$HOME/.republic/config/config.toml"
PEERS="6313f892ee50ca0b2d6cc6411ac5207dbf2d164b@95.216.102.220:13356"
sed -i -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" "$HOME/.republic/config/config.toml"
sudo systemctl restart republicd
sudo journalctl -u republicd -f -o cat