2019-11-15 22:56:29 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
2020-05-24 08:27:36 -07:00
|
|
|
# shellcheck source=multinode-demo/common.sh
|
|
|
|
source multinode-demo/common.sh
|
2019-11-15 22:56:29 -08:00
|
|
|
|
2020-05-24 08:27:36 -07:00
|
|
|
rm -rf config/run/init-completed config/ledger config/snapshot-ledger
|
2019-11-15 22:56:29 -08:00
|
|
|
|
2022-02-09 11:26:35 -08:00
|
|
|
SOLANA_RUN_SH_VALIDATOR_ARGS="--full-snapshot-interval-slots 200" timeout 120 ./scripts/run.sh &
|
2019-11-15 22:56:29 -08:00
|
|
|
pid=$!
|
|
|
|
|
2019-11-25 15:11:55 -08:00
|
|
|
attempts=20
|
2019-11-15 22:56:29 -08:00
|
|
|
while [[ ! -f config/run/init-completed ]]; do
|
|
|
|
sleep 1
|
|
|
|
if ((--attempts == 0)); then
|
|
|
|
echo "Error: validator failed to boot"
|
|
|
|
exit 1
|
2021-03-30 15:51:14 -07:00
|
|
|
else
|
|
|
|
echo "Checking init"
|
2019-11-15 22:56:29 -08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-06-24 20:48:28 -07:00
|
|
|
snapshot_slot=1
|
2022-05-26 13:44:09 -07:00
|
|
|
latest_slot=0
|
2020-06-24 20:48:28 -07:00
|
|
|
|
|
|
|
# wait a bit longer than snapshot_slot
|
2022-05-26 13:44:09 -07:00
|
|
|
while [[ $latest_slot -le $((snapshot_slot + 1)) ]]; do
|
2020-05-26 16:20:28 -07:00
|
|
|
sleep 1
|
2021-03-30 15:51:14 -07:00
|
|
|
echo "Checking slot"
|
2022-05-26 13:44:09 -07:00
|
|
|
latest_slot=$($solana_cli --url http://localhost:8899 slot --commitment processed)
|
2020-05-26 16:20:28 -07:00
|
|
|
done
|
2021-02-26 21:42:09 -08:00
|
|
|
|
2021-03-10 15:28:42 -08:00
|
|
|
$solana_validator --ledger config/ledger exit --force || true
|
2019-11-15 22:56:29 -08:00
|
|
|
|
|
|
|
wait $pid
|
2020-05-24 08:27:36 -07:00
|
|
|
|
2020-06-24 20:48:28 -07:00
|
|
|
$solana_ledger_tool create-snapshot --ledger config/ledger "$snapshot_slot" config/snapshot-ledger
|
2020-05-24 08:27:36 -07:00
|
|
|
cp config/ledger/genesis.tar.bz2 config/snapshot-ledger
|
2022-05-26 13:44:09 -07:00
|
|
|
$solana_ledger_tool copy --ledger config/ledger \
|
|
|
|
--target-db config/snapshot-ledger --starting-slot "$snapshot_slot" --ending-slot "$latest_slot"
|
2023-12-18 16:50:41 -08:00
|
|
|
$solana_ledger_tool verify --ledger config/snapshot-ledger --block-verification-method blockstore-processor
|
|
|
|
$solana_ledger_tool verify --ledger config/snapshot-ledger --block-verification-method unified-scheduler
|