diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2017-11-06 23:08:55 +0100 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2017-11-10 17:16:07 +0100 |
commit | 109a85899571aa499572e211bb08f05715e8743b (patch) | |
tree | 0a5db134a775920a176e27e76bcf0f69a07dd214 /src/test/txvalidationcache_tests.cpp | |
parent | fe503e118f08a9a781d8cc1a6cdde5a615178433 (diff) |
tests: Add missing locks to tests
Add missing locks to tests to satisfy lock requirements (such as
EXCLUSIVE_LOCKS_REQUIRED(...) (Clang Thread Safety Analysis),
AssertLockHeld(...) and implicit lock assumptions).
Diffstat (limited to 'src/test/txvalidationcache_tests.cpp')
-rw-r--r-- | src/test/txvalidationcache_tests.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp index 7d551a7bb4..ce3060a5f3 100644 --- a/src/test/txvalidationcache_tests.cpp +++ b/src/test/txvalidationcache_tests.cpp @@ -66,6 +66,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup) // Test 1: block with both of those transactions should be rejected. block = CreateAndProcessBlock(spends, scriptPubKey); + LOCK(cs_main); BOOST_CHECK(chainActive.Tip()->GetBlockHash() != block.GetHash()); // Test 2: ... and should be rejected if spend1 is in the memory pool @@ -151,7 +152,10 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup) { // Test that passing CheckInputs with one set of script flags doesn't imply // that we would pass again with a different set of flags. - InitScriptExecutionCache(); + { + LOCK(cs_main); + InitScriptExecutionCache(); + } CScript p2pk_scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG; CScript p2sh_scriptPubKey = GetScriptForDestination(CScriptID(p2pk_scriptPubKey)); |