HomePhabricator

tests: reset fIsBareMultisigStd after bare-multisig tests

Description

tests: reset fIsBareMultisigStd after bare-multisig tests

Summary:
This fixes a bug in the unit tests that was introduced in D8308

The bug this fixes is two-part.

1.The fIsBareMultisigStd global is being reused by other tests,
i.e script_p2sh_tests(set), after being set to false.

  1. 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 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:

test/script_p2sh_tests.cpp:200: error: in "script_p2sh_tests/set": txTo[1].IsStandard

will occur (on most systems).

This is a backport of Core PR18018

Test Plan:
I tested with the random seed mentioned in the PR description (but this does not cause the bug on my system)

src/test/test_bitcoin --random=99999

I was able to reproduce the error with seed 874756305. This fails before this commit, and succeeded after:

src/test/test_bitcoin --log_level=test_suite --run_test=transaction_tests,script_p2sh_tests --random=874756305

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8321

Details

Provenance
fanquake <fanquake@gmail.com>Authored on Nov 9 2020, 08:39
PiRKCommitted on Nov 9 2020, 08:39
abc-botPushed on Nov 9 2020, 08:45
Reviewer
Restricted Project
Differential Revision
D8321: tests: reset fIsBareMultisigStd after bare-multisig tests
Parents
rABCfb09258947f4: Simplify progress reprort for the UTXO DB upgrade
Branches
Unknown
Tags
Unknown