File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ _is_port_bound() {
3636}
3737
3838_wait_for_bitcoind () {
39- # wait for bitcoind to be up
39+ # wait until bitcoind RPC is actually ready
4040 start_time=$( date +%s)
41- until $COMPOSE logs bitcoind | grep -q ' Bound to ' ; do
41+ until $BITCOIN_CLI getblockchaininfo > /dev/null 2>&1 ; do
4242 current_time=$( date +%s)
4343 if [ $(( current_time - start_time)) -gt $TIMEOUT ]; then
44- echo " Timeout waiting for bitcoind to start "
44+ echo " Timeout waiting for bitcoind RPC to become ready "
4545 $COMPOSE logs bitcoind
4646 exit 1
4747 fi
@@ -74,11 +74,13 @@ _start_services() {
7474 _die " port $port is already bound, services can't be started"
7575 fi
7676 done
77- $COMPOSE up -d
77+ # start bitcoind first to avoid depending services failing due to RPC unavailability
78+ $COMPOSE up -d bitcoind
7879 echo && echo " preparing bitcoind wallet"
7980 _wait_for_bitcoind
8081 $BITCOIN_CLI createwallet miner > /dev/null
8182 $BITCOIN_CLI -rpcwallet=miner -generate $INITIAL_BLOCKS > /dev/null
83+ $COMPOSE up -d
8284 echo " waiting for electrs to have completed startup"
8385 _wait_for_electrs
8486}
You can’t perform that action at this time.
0 commit comments