Merge #18018: tests: reset fIsBareMultisigStd after bare-multisig tests

1b96a3cd1e tests: reset fIsBareMultisigStd after bare-multisig tests (fanquake)

Pull request description:

  Fixes: #18015

  The bug this fixes is two-part.

  1. The `fIsBareMultisigStd` global is being reused by other tests,
  such as [script_p2sh_tests(set)](https://github.com/bitcoin/bitcoin/blob/master/src/test/script_p2sh_tests.cpp#L150), after being set to false.

  2. The order our tests run in doesn't always? seem to be random,
  which meant that the `script_p2sh` tests would only fail if they
  were run in an order where the `transaction_tests` ran first,
  mutating the `fIsBareMultisigStd` global.

  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):

  ```bash
  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.

ACKs for top commit:
  Empact:
    Code Review ACK 1b96a3cd1e
  theStack:
    ACK https://github.com/bitcoin/bitcoin/pull/18018/commits/1b96a3cd1ebe725896f59614903184289fe62c

Tree-SHA512: fd7578f9f3faa44d236cd007fc25e31f061acabdb8458559fde0e67d11ab5cafed15305993270c9943a50326574bc5f5301b09494a5b0d2de69e64978093ed45
This commit is contained in:
MarcoFalke 2020-01-31 02:50:40 +13:00
commit 0130abbdb7
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -831,6 +831,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "bare-multisig");
fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG;
}
BOOST_AUTO_TEST_SUITE_END()