diff --git a/src/miner.h b/src/miner.h --- a/src/miner.h +++ b/src/miner.h @@ -184,7 +184,7 @@ // Methods for how to add transactions to a block. /** Add transactions based on tx "priority" */ - void addPriorityTxs(); + void addPriorityTxs() EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); /** * Add transactions based on feerate including unconfirmed ancestors. * Increments nPackagesSelected / nDescendantsUpdated with corresponding @@ -204,7 +204,8 @@ /** Test if tx will still "fit" in the block */ TestForBlockResult TestForBlock(CTxMemPool::txiter iter); /** Test if tx still has unconfirmed parents not yet in block */ - bool isStillDependent(CTxMemPool::txiter iter); + bool isStillDependent(CTxMemPool::txiter iter) + EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); // helper functions for addPackageTxs() /** Remove confirmed (inBlock) entries from given set */ diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp --- a/src/test/mempool_tests.cpp +++ b/src/test/mempool_tests.cpp @@ -20,6 +20,7 @@ BOOST_AUTO_TEST_CASE(TestPackageAccounting) { CTxMemPool testPool; + LOCK(testPool.cs); TestMemPoolEntryHelper entry; CMutableTransaction parentOfAll; @@ -229,6 +230,7 @@ } CTxMemPool testPool; + LOCK(testPool.cs); // Nothing in pool, clear should do nothing: testPool.clear();