aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-10-13 11:16:18 +0200
committerfanquake <fanquake@gmail.com>2023-10-13 11:16:33 +0200
commit73dfa6da0801e3116e7e84cd5e089b98a9f70212 (patch)
tree402e564a0cf66ff4833e9b412ab31f6b94381575
parent448790c00adcf521c4df8552451be1d51d117512 (diff)
parent36a3004a41aea58f50f3348c5de4eb5a23268788 (diff)
Merge bitcoin/bitcoin#28631: devtools: test_utxo_snapshots.sh sleep cleanup and documentation
36a3004a41aea58f50f3348c5de4eb5a23268788 devtools: test_utxo_snapshots.sh sleep cleanup and documentation (Fabian Jahr) Pull request description: There were bare sleep statements in the script where it was unclear why they were needed and I think they could also be replaced by existing helpers. ACKs for top commit: Sjors: utACK 36a3004a41aea58f50f3348c5de4eb5a23268788 pablomartin4btc: utACK https://github.com/bitcoin/bitcoin/commit/36a3004a41aea58f50f3348c5de4eb5a23268788 Tree-SHA512: b6e2fc69cd7babcfa7f413f11304f4d648d6d64b3b526862664ccedb0016ad182b9e886aa4e8c33315e4c18824512e11a4fd6365f9c3c95093967d3ef7687e62
-rwxr-xr-xcontrib/devtools/test_utxo_snapshots.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/devtools/test_utxo_snapshots.sh b/contrib/devtools/test_utxo_snapshots.sh
index d4c49bf098..f5918d7738 100755
--- a/contrib/devtools/test_utxo_snapshots.sh
+++ b/contrib/devtools/test_utxo_snapshots.sh
@@ -72,6 +72,9 @@ server_sleep_til_boot() {
client_sleep_til_boot() {
while ! client_rpc ping >/dev/null 2>&1; do sleep 0.1; done
}
+server_sleep_til_shutdown() {
+ while server_rpc ping >/dev/null 2>&1; do sleep 0.1; done
+}
mkdir -p "$SERVER_DATADIR" "$CLIENT_DATADIR"
@@ -109,7 +112,7 @@ echo "-- IBDing the blocks (height=$BASE_HEIGHT) required to the server node..."
echo
echo "-- Creating snapshot at ~ height $BASE_HEIGHT ($UTXO_DAT_FILE)..."
-sleep 2
+server_sleep_til_shutdown # wait for stopatheight to be hit
./src/bitcoind -logthreadnames=1 $SERVER_PORTS \
-datadir="$SERVER_DATADIR" $EARLY_IBD_FLAGS -connect=0 -listen=0 >/dev/null &
SERVER_PID="$!"
@@ -124,8 +127,7 @@ RPC_AU=$(jq -r .txoutset_hash < "$DUMP_OUTPUT")
RPC_NCHAINTX=$(jq -r .nchaintx < "$DUMP_OUTPUT")
RPC_BLOCKHASH=$(jq -r .base_hash < "$DUMP_OUTPUT")
-# Wait for server to shutdown...
-while server_rpc ping >/dev/null 2>&1; do sleep 0.1; done
+server_sleep_til_shutdown
echo
echo "-- Now: add the following to CMainParams::m_assumeutxo_data"
@@ -186,9 +188,7 @@ echo " Press CTRL+C after you're satisfied to exit the demo"
echo
read -p "Press [enter] to continue"
-while kill -0 "$CLIENT_PID"; do
- sleep 1
-done
+client_sleep_til_boot
./src/bitcoind $CLIENT_PORTS $ALL_INDEXES -logthreadnames=1 -datadir="$CLIENT_DATADIR" -connect=0 \
-addnode=127.0.0.1:$SERVER_PORT "$EARLY_IBD_FLAGS" >/dev/null &
CLIENT_PID="$!"