Fixes: #18015
The bug this fixes is two-part.
The
fIsBareMultisigStdglobal is being reused by other tests, such as script_p2sh_tests(set), after being set to false.The order our tests run in doesn't always? seem to be random, which meant that the
script_p2shtests would only fail if they were run in an order where thetransaction_testsran first, mutating thefIsBareMultisigStdglobal.
This doesn't seem to happen when running make check, but if you
run src/test/test_bitcoin and pass --random=99999, the failure
in script_p2sh will occur (on most, but maybe not all systems):
src/test/test_bitcoin --random=99999
Running 389 test cases...
test/script_p2sh_tests.cpp:200: error: in "script_p2sh_tests/set": txTo[1].IsStandard
test/script_p2sh_tests.cpp:200: error: in "script_p2sh_tests/set": txTo[2].IsStandard
test/script_p2sh_tests.cpp:200: error: in "script_p2sh_tests/set": txTo[3].IsStandard
*** 3 failures are detected in the test module "Bitcoin Core Test Suite"
The new test for bare multisig was introduced in #17502.