@@ -72,6 +72,9 @@ server_sleep_til_boot() {
7272client_sleep_til_boot () {
7373 while ! client_rpc ping > /dev/null 2>&1 ; do sleep 0.1; done
7474}
75+ server_sleep_til_shutdown () {
76+ while server_rpc ping > /dev/null 2>&1 ; do sleep 0.1; done
77+ }
7578
7679mkdir -p " $SERVER_DATADIR " " $CLIENT_DATADIR "
7780
@@ -109,7 +112,7 @@ echo "-- IBDing the blocks (height=$BASE_HEIGHT) required to the server node..."
109112
110113echo
111114echo " -- Creating snapshot at ~ height $BASE_HEIGHT ($UTXO_DAT_FILE )..."
112- sleep 2
115+ server_sleep_til_shutdown # wait for stopatheight to be hit
113116./src/bitcoind -logthreadnames=1 $SERVER_PORTS \
114117 -datadir=" $SERVER_DATADIR " $EARLY_IBD_FLAGS -connect=0 -listen=0 > /dev/null &
115118SERVER_PID=" $! "
@@ -124,8 +127,7 @@ RPC_AU=$(jq -r .txoutset_hash < "$DUMP_OUTPUT")
124127RPC_NCHAINTX=$( jq -r .nchaintx < " $DUMP_OUTPUT " )
125128RPC_BLOCKHASH=$( jq -r .base_hash < " $DUMP_OUTPUT " )
126129
127- # Wait for server to shutdown...
128- while server_rpc ping > /dev/null 2>&1 ; do sleep 0.1; done
130+ server_sleep_til_shutdown
129131
130132echo
131133echo " -- 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"
186188echo
187189read -p " Press [enter] to continue"
188190
189- while kill -0 " $CLIENT_PID " ; do
190- sleep 1
191- done
191+ client_sleep_til_boot
192192./src/bitcoind $CLIENT_PORTS $ALL_INDEXES -logthreadnames=1 -datadir=" $CLIENT_DATADIR " -connect=0 \
193193 -addnode=127.0.0.1:$SERVER_PORT " $EARLY_IBD_FLAGS " > /dev/null &
194194CLIENT_PID=" $! "
0 commit comments