diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-11-08 11:07:36 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-11-15 13:40:08 -0500 |
commit | 8888ad02e204b0fa7a2ea2cfed2fc3f298cf1623 (patch) | |
tree | 7f8eb7835c9bd5452d655f8d77bf1d28c8a78442 /src/test/txvalidationcache_tests.cpp | |
parent | fac07f2038a3ccd5edadc6e6122c02fa30e697bd (diff) |
test: Replace recursive lock with locking annotations
Also, use m_node.mempool instead of the global
Diffstat (limited to 'src/test/txvalidationcache_tests.cpp')
-rw-r--r-- | src/test/txvalidationcache_tests.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp index a5bc15bb9f..49aa344b33 100644 --- a/src/test/txvalidationcache_tests.cpp +++ b/src/test/txvalidationcache_tests.cpp @@ -17,16 +17,6 @@ bool CheckInputs(const CTransaction& tx, TxValidationState &state, const CCoinsV BOOST_AUTO_TEST_SUITE(tx_validationcache_tests) -static bool -ToMemPool(const CMutableTransaction& tx) -{ - LOCK(cs_main); - - TxValidationState state; - return AcceptToMemoryPool(mempool, state, MakeTransactionRef(tx), - nullptr /* plTxnReplaced */, true /* bypass_limits */, 0 /* nAbsurdFee */); -} - BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup) { // Make sure skipping validation of transactions that were @@ -35,6 +25,14 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup) CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG; + const auto ToMemPool = [this](const CMutableTransaction& tx) { + LOCK(cs_main); + + TxValidationState state; + return AcceptToMemoryPool(*m_node.mempool, state, MakeTransactionRef(tx), + nullptr /* plTxnReplaced */, true /* bypass_limits */, 0 /* nAbsurdFee */); + }; + // Create a double-spend of mature coinbase txn: std::vector<CMutableTransaction> spends; spends.resize(2); |