mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
test: Replace recursive lock with locking annotations
Also, use m_node.mempool instead of the global
This commit is contained in:
parent
fac07f2038
commit
8888ad02e2
2 changed files with 20 additions and 18 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue