Skip to content

Instantly share code, notes, and snippets.

@ryssroad
Last active December 8, 2022 09:57
Show Gist options
  • Select an option

  • Save ryssroad/f012179368a55865c9e64d0e3b3583be to your computer and use it in GitHub Desktop.

Select an option

Save ryssroad/f012179368a55865c9e64d0e3b3583be to your computer and use it in GitHub Desktop.
noisd state | roadz
peers="8073bd66d5fa581c7b3d0a08d0df1fe318d70d99@135.181.35.46:55656"; \
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.noisd/config/config.toml
SNAP_RPC="https://xp.systemd.run:55657"; \
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); \
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH
sed -i -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\"|" ~/.noisd/config/config.toml
sudo systemctl stop noisd && \
noisd tendermint unsafe-reset-all --home $HOME/.noisd && \
sudo systemctl restart noisd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment