diff --git a/contrib/devtools/test_utxo_snapshots.sh b/contrib/devtools/test_utxo_snapshots.sh index d4c49bf098f289..8a2b69c57bad65 100755 --- a/contrib/devtools/test_utxo_snapshots.sh +++ b/contrib/devtools/test_utxo_snapshots.sh @@ -11,13 +11,16 @@ # loaded. We see the background validation chainstate removed after validation # completes. # +# The shellcheck rule SC2086 (quoted variables) disablements are necessary +# since this rule needs to be violated in order to get bitcoind to pick up on +# $CHAIN_HACK_FLAGS for the script to work. export LC_ALL=C set -e BASE_HEIGHT=${1:-30000} INCREMENTAL_HEIGHT=20000 -FINAL_HEIGHT=$(($BASE_HEIGHT + $INCREMENTAL_HEIGHT)) +FINAL_HEIGHT=$((BASE_HEIGHT + INCREMENTAL_HEIGHT)) SERVER_DATADIR="$(pwd)/utxodemo-data-server-$BASE_HEIGHT" CLIENT_DATADIR="$(pwd)/utxodemo-data-client-$BASE_HEIGHT" @@ -104,12 +107,14 @@ read -p "Press [enter] to continue" _ echo echo "-- IBDing the blocks (height=$BASE_HEIGHT) required to the server node..." +# shellcheck disable=SC2086 ./src/bitcoind -logthreadnames=1 $SERVER_PORTS \ -datadir="$SERVER_DATADIR" $EARLY_IBD_FLAGS -stopatheight="$BASE_HEIGHT" >/dev/null echo echo "-- Creating snapshot at ~ height $BASE_HEIGHT ($UTXO_DAT_FILE)..." sleep 2 +# shellcheck disable=SC2086 ./src/bitcoind -logthreadnames=1 $SERVER_PORTS \ -datadir="$SERVER_DATADIR" $EARLY_IBD_FLAGS -connect=0 -listen=0 >/dev/null & SERVER_PID="$!" @@ -135,11 +140,13 @@ echo " {${RPC_BASE_HEIGHT}, AssumeutxoHash{uint256S(\"0x${RPC_AU}\")}, ${RPC_N echo echo echo "-- IBDing more blocks to the server node (height=$FINAL_HEIGHT) so there is a diff between snapshot and tip..." +# shellcheck disable=SC2086 ./src/bitcoind $SERVER_PORTS -logthreadnames=1 -datadir="$SERVER_DATADIR" \ $EARLY_IBD_FLAGS -stopatheight="$FINAL_HEIGHT" >/dev/null echo echo "-- Starting the server node to provide blocks to the client node..." +# shellcheck disable=SC2086 ./src/bitcoind $SERVER_PORTS -logthreadnames=1 -debug=net -datadir="$SERVER_DATADIR" \ $EARLY_IBD_FLAGS -connect=0 -listen=1 >/dev/null & SERVER_PID="$!" @@ -163,6 +170,7 @@ read -p "When you're ready for all this, hit [enter]" _ echo echo "-- Starting the client node to get headers from the server, then load the snapshot..." +# shellcheck disable=SC2086 ./src/bitcoind $CLIENT_PORTS $ALL_INDEXES -logthreadnames=1 -datadir="$CLIENT_DATADIR" \ -connect=0 -addnode=127.0.0.1:$SERVER_PORT -debug=net $EARLY_IBD_FLAGS >/dev/null & CLIENT_PID="$!" @@ -189,6 +197,7 @@ read -p "Press [enter] to continue" while kill -0 "$CLIENT_PID"; do sleep 1 done +# shellcheck disable=SC2086 ./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="$!" diff --git a/test/lint/lint-shell.py b/test/lint/lint-shell.py index db84ca3d394e2e..7fb78894af3e6b 100755 --- a/test/lint/lint-shell.py +++ b/test/lint/lint-shell.py @@ -70,7 +70,7 @@ def main(): reg = re.compile(r'src/[leveldb,secp256k1,minisketch]') def should_exclude(fname: str) -> bool: - return bool(reg.match(fname)) or 'test_utxo_snapshots.sh' in fname + return bool(reg.match(fname)) # remove everything that doesn't match this regex files[:] = [file for file in files if not should_exclude(file)]