aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-07-28 11:09:58 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-07-29 08:04:06 -0400
commitfa5ed4f8d2c4cb3507bcc2460725d483f2e5789c (patch)
tree0dabe170ab89702055257cf214ab1de431aa4a9b /src/bench
parentad51e1372bc645fc8710da2bc9e0a9fc6c0f27bb (diff)
refactor: Avoid locking tx pool cs thrice
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/mempool_eviction.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bench/mempool_eviction.cpp b/src/bench/mempool_eviction.cpp
index 4c947a519f..d37291b900 100644
--- a/src/bench/mempool_eviction.cpp
+++ b/src/bench/mempool_eviction.cpp
@@ -9,7 +9,7 @@
#include <list>
#include <vector>
-static void AddTx(const CTransactionRef& tx, const CAmount& nFee, CTxMemPool& pool)
+static void AddTx(const CTransactionRef& tx, const CAmount& nFee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
{
int64_t nTime = 0;
unsigned int nHeight = 1;
@@ -108,6 +108,7 @@ static void MempoolEviction(benchmark::State& state)
tx7.vout[1].nValue = 10 * COIN;
CTxMemPool pool;
+ LOCK(pool.cs);
// Create transaction references outside the "hot loop"
const CTransactionRef tx1_r{MakeTransactionRef(tx1)};
const CTransactionRef tx2_r{MakeTransactionRef(tx2)};