|
@ -172,7 +172,7 @@ spec: |
|
|
|
|
|
|
|
|
# fill genesis file with validators |
|
|
# fill genesis file with validators |
|
|
IFS=',' read -ra VALS_ARR <<< "$VALIDATORS" |
|
|
IFS=',' read -ra VALS_ARR <<< "$VALIDATORS" |
|
|
fqdn_suffix=$(echo $(hostname -f) | sed 's#[^.]*\.\(\)#\1#') |
|
|
|
|
|
|
|
|
fqdn_suffix=$(hostname -f | sed 's#[^.]*\.\(\)#\1#') |
|
|
for v in "${VALS_ARR[@]}"; do |
|
|
for v in "${VALS_ARR[@]}"; do |
|
|
# wait until validator generates priv/pub key pair |
|
|
# wait until validator generates priv/pub key pair |
|
|
set +e |
|
|
set +e |
|
@ -188,7 +188,7 @@ spec: |
|
|
|
|
|
|
|
|
# add validator to genesis file along with its pub_key |
|
|
# add validator to genesis file along with its pub_key |
|
|
curl -s "http://$v.$fqdn_suffix/pub_key.json" | jq ". as \$k | {pub_key: \$k, amount: $VALIDATOR_POWER, name: \"$v\"}" > pub_validator.json |
|
|
curl -s "http://$v.$fqdn_suffix/pub_key.json" | jq ". as \$k | {pub_key: \$k, amount: $VALIDATOR_POWER, name: \"$v\"}" > pub_validator.json |
|
|
cat /tendermint/genesis.json | jq ".validators |= .+ [$(cat pub_validator.json)]" > /tendermint/genesis.json |
|
|
|
|
|
|
|
|
cat /tendermint/genesis.json | jq ".validators |= .+ [$(cat pub_validator.json)]" > tmpgenesis && mv tmpgenesis /tendermint/genesis.json |
|
|
rm pub_validator.json |
|
|
rm pub_validator.json |
|
|
done |
|
|
done |
|
|
|
|
|
|
|
@ -222,11 +222,11 @@ spec: |
|
|
|
|
|
|
|
|
# replace "tm-N" with public keys in genesis file |
|
|
# replace "tm-N" with public keys in genesis file |
|
|
cp /etc/app/genesis.json genesis.json |
|
|
cp /etc/app/genesis.json genesis.json |
|
|
fqdn_suffix=$(echo $(hostname -f) | sed 's#[^.]*\.\(\)#\1#') |
|
|
|
|
|
|
|
|
fqdn_suffix=$(hostname -f | sed 's#[^.]*\.\(\)#\1#') |
|
|
# for every "base/account" |
|
|
# for every "base/account" |
|
|
i=3 |
|
|
i=3 |
|
|
length=$(cat genesis.json | jq ". | length") |
|
|
length=$(cat genesis.json | jq ". | length") |
|
|
while [ $i -lt $length ]; do |
|
|
|
|
|
|
|
|
while [[ $i -lt $length ]]; do |
|
|
# extract pod name ("tm-0") |
|
|
# extract pod name ("tm-0") |
|
|
pod=$(cat genesis.json | jq -r ".[$i].pub_key[0]") |
|
|
pod=$(cat genesis.json | jq -r ".[$i].pub_key[0]") |
|
|
|
|
|
|
|
@ -246,7 +246,7 @@ spec: |
|
|
curl -s "http://$pod.$fqdn_suffix/app_pub_key.json" | jq "." > k.json |
|
|
curl -s "http://$pod.$fqdn_suffix/app_pub_key.json" | jq "." > k.json |
|
|
|
|
|
|
|
|
# replace pod name with it (["tm-0"] => "[1, XXXXXXXXXXXXXXXXXXXX]") |
|
|
# replace pod name with it (["tm-0"] => "[1, XXXXXXXXXXXXXXXXXXXX]") |
|
|
cat genesis.json | jq ".[$i].pub_key = $(cat k.json | jq '.')" > genesis.json |
|
|
|
|
|
|
|
|
cat genesis.json | jq ".[$i].pub_key = $(cat k.json | jq '.')" > tmpgenesis && mv tmpgenesis genesis.json |
|
|
rm -f k.json |
|
|
rm -f k.json |
|
|
|
|
|
|
|
|
i=$((i+2)) # skip "base/account" field itself |
|
|
i=$((i+2)) # skip "base/account" field itself |
|
|