-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/bash | ||
echo "> Creating arrays" | ||
|
||
monikers=() | ||
homes=() | ||
api_ports=() | ||
rpc_ports=() | ||
p2p_ports=() | ||
grpc_ports=() | ||
pprof_ports=() | ||
logs=() | ||
for i in $(seq -w 001 $validator_count) | ||
do | ||
moniker=$moniker_prefix$i | ||
monikers+=($moniker) | ||
home=$home_prefix$i | ||
homes+=($home) | ||
api_port=$api_prefix$i | ||
api_ports+=($api_port) | ||
rpc_port=$rpc_prefix$i | ||
rpc_ports+=($rpc_port) | ||
p2p_port=$p2p_prefix$i | ||
p2p_ports+=($p2p_port) | ||
grpc_port=$grpc_prefix$i | ||
grpc_ports+=($grpc_port) | ||
pprof_port=$pprof_prefix$i | ||
pprof_ports+=($pprof_port) | ||
log=$log_prefix$i | ||
logs+=($log) | ||
done | ||
|
||
home=.nodesync | ||
rpc_port=${rpc_prefix}999 | ||
api_port=${api_prefix}999 | ||
p2p_port=${p2p_prefix}999 | ||
grpc_port=${grpc_prefix}999 | ||
pprof_port=${pprof_prefix}999 | ||
log=${log_prefix}999 | ||
|
||
rm -rf $home | ||
echo "> Creating home" | ||
$CHAIN_BINARY config set client chain-id $CHAIN_ID --home $home | ||
$CHAIN_BINARY config set client keyring-backend test --home $home | ||
$CHAIN_BINARY config set client broadcast-mode sync --home $home | ||
$CHAIN_BINARY config set client node tcp://localhost:$rpc_port --home $home | ||
$CHAIN_BINARY init nodesync --chain-id $CHAIN_ID --home $home &> /dev/null | ||
|
||
echo "> Copying genesis" | ||
cp ${homes[0]}/config/genesis.json $home/config/genesis.json | ||
|
||
toml set --toml-path $home/config/app.toml minimum-gas-prices "$GAS_PRICE" | ||
toml set --toml-path $home/config/app.toml api.enable true | ||
toml set --toml-path $home/config/app.toml api.enabled-unsafe-cors true | ||
toml set --toml-path $home/config/app.toml api.address "tcp://0.0.0.0:$api_port" | ||
toml set --toml-path $home/config/app.toml grpc.address "0.0.0.0:$grpc_port" | ||
toml set --toml-path $home/config/app.toml grpc-web.enable false | ||
|
||
echo "> Configuring config.toml" | ||
node_id=$($CHAIN_BINARY tendermint show-node-id --home ${homes[-1]}) | ||
peer="$node_id@127.0.0.1:${p2p_ports[-1]}" | ||
toml set --toml-path $home/config/config.toml rpc.laddr "tcp://0.0.0.0:$rpc_port" | ||
toml set --toml-path $home/config/config.toml rpc.pprof_laddr "0.0.0.0:$pprof_port" | ||
toml set --toml-path $home/config/config.toml p2p.laddr "tcp://0.0.0.0:$p2p_port" | ||
sed -i -e '/addr_book_strict =/ s/= .*/= false/' $home/config/config.toml | ||
sed -i -e '/allow_duplicate_ip =/ s/= .*/= true/' $home/config/config.toml | ||
toml set --toml-path $home/config/config.toml block_sync false | ||
toml set --toml-path $home/config/config.toml consensus.timeout_commit "${TIMEOUT_COMMIT}s" | ||
toml set --toml-path $home/config/config.toml p2p.persistent_peers "$peer" | ||
|
||
echo "> Copying data folder" | ||
./stop.sh | ||
cp $home/data/priv_validator_state.json ./ | ||
cp -r ${homes[-1]}/data $home/data | ||
cp ./priv_validator_state.json $home/data/ | ||
./start.sh | ||
|
||
echo "> Starting snapshot sync node" | ||
tmux new-session -d -s snapshot "$CHAIN_BINARY start --home $home 2>&1 | tee $log" | ||
|
||
sleep 120 | ||
catching_up=$(curl -s http://localhost:$rpc_port/status | jq -r .result.sync_info.catching_up) | ||
echo "> Catching up: $catching_up" | ||
|
||
tmux send-keys -t snapshot C-c | ||
|
||
if [ $catching_up != "false" ]; then | ||
echo "Node did not sync." | ||
exit 1 | ||
fi |
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