What changed, and why it matters
This change fixes a test helper script so that if a Bitcoin command-line tool fails, the failure is properly noticed and the test stops. It only affects internal regression tests, not the Electrum wallet that users run. There is no direct security risk to end users.
No security action needed. Treat as a normal test-quality commit. If backporting, include it only for CI/test stability, not for a security fix.
Security signals we found
Masking of command exit status in shell test expression
Regression test script reliability improvement
No product code or wallet behavior changed
Evidence from the diff
In tests/regtest/regtest.sh, the wait_until_spent function previously ran bitcoin_cli inside the while loop’s test expression. When bitcoin_cli errored out (e.g., because $1 was the literal string ‘null’ from jq), its non-zero exit code was masked by the [[ … ]] test, so the loop continued silently. The patch moves the command out of the test into a separate assignment; with set -e active, a bitcoin_cli failure now aborts the script. This is a test-harness robustness improvement, not a product vulnerability fix.
Changed components
tests/regtest/regtest.shInspect captured patch +3 / −1
diff --git a/tests/regtest/regtest.sh b/tests/regtest/regtest.sh
index f0a66f3..614436c 100755
--- a/tests/regtest/regtest.sh
+++ b/tests/regtest/regtest.sh
@@ -130,7 +130,9 @@ function wait_until_spent()
declare -i timeout_sec=120
declare -i elapsed_sec=0
- while [[ $($bitcoin_cli gettxout $1 $2) ]]; do
+ while true; do
+ utxo=$($bitcoin_cli gettxout $1 $2)
+ if [[ -z "$utxo" ]]; then break; fi # utxo is spent (or never existed!)
if ((elapsed_sec > timeout_sec)); then
printf "Timeout of %i s exceeded\n" "$elapsed_sec"
exit 1
Why this scored 11/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.