aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2018-07-30 11:33:05 -0400
committerJames O'Beirne <james.obeirne@gmail.com>2018-07-30 12:08:22 -0400
commit6f53edb395e0020783b6a14cb6476b637c312914 (patch)
tree10bb0ac9ddfad04e916e317abcd4c02ac48cb830 /src/bench
parent63d73f5bc8546136cf745b0b4cb36c3081541068 (diff)
downloadbitcoin-6f53edb395e0020783b6a14cb6476b637c312914.tar.xz
Acquire cs_main before ATMP call in block_assemble bench
Otherwise we fail an assert in sync.cpp:AssertLockHeldInternal.
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/block_assemble.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bench/block_assemble.cpp b/src/bench/block_assemble.cpp
index 36fa175a76..9b53c6b023 100644
--- a/src/bench/block_assemble.cpp
+++ b/src/bench/block_assemble.cpp
@@ -97,10 +97,14 @@ static void AssembleBlock(benchmark::State& state)
if (NUM_BLOCKS - b >= COINBASE_MATURITY)
txs.at(b) = MakeTransactionRef(tx);
}
- for (const auto& txr : txs) {
- CValidationState state;
- bool ret{::AcceptToMemoryPool(::mempool, state, txr, nullptr /* pfMissingInputs */, nullptr /* plTxnReplaced */, false /* bypass_limits */, /* nAbsurdFee */ 0)};
- assert(ret);
+ {
+ LOCK(::cs_main); // Required for ::AcceptToMemoryPool.
+
+ for (const auto& txr : txs) {
+ CValidationState state;
+ bool ret{::AcceptToMemoryPool(::mempool, state, txr, nullptr /* pfMissingInputs */, nullptr /* plTxnReplaced */, false /* bypass_limits */, /* nAbsurdFee */ 0)};
+ assert(ret);
+ }
}
while (state.KeepRunning()) {