diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-07-30 16:16:16 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-07-30 16:18:23 -0400 |
commit | 84d5a6210c9c73c3e03d8b024887553051500b92 (patch) | |
tree | a6f5c51e96c86032e9e6afaa3ee6b1b726e77b46 /src/bench | |
parent | d25079ac7169b119021a06c93a0086aa3c7afc5b (diff) | |
parent | fa5ed4f8d2c4cb3507bcc2460725d483f2e5789c (diff) |
Merge #13786: refactor: Avoid locking tx pool cs thrice
fa5ed4f8d2 refactor: Avoid locking tx pool cs thrice (MarcoFalke)
Pull request description:
`addUnchecked` is (outside the tests) only called by ATMP, which already takes the tx pool read lock. So locking it twice more in both `addUnchecked` methods seems redundant.
Similarly `CalculateMemPoolAncestors` is (beside once in the wallet) only called in contexts, where the tx pool lock is already taken. So remove the lock there as well.
Tree-SHA512: fcf603b570da0fc529fe6db8add218663eae52845510732bee0d4611263d2429d3d3c9c8ae68493d67287d13504500ed51905ccbe711eb15a0af3b019edad543
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/mempool_eviction.cpp | 3 |
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)}; |