Acquire cs_main before ATMP call in block_assemble bench

Otherwise we fail an assert in sync.cpp:AssertLockHeldInternal.
This commit is contained in:
James O'Beirne 2018-07-30 11:33:05 -04:00
parent 63d73f5bc8
commit 6f53edb395
1 changed files with 8 additions and 4 deletions

View File

@ -97,11 +97,15 @@ static void AssembleBlock(benchmark::State& state)
if (NUM_BLOCKS - b >= COINBASE_MATURITY)
txs.at(b) = MakeTransactionRef(tx);
}
{
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()) {
PrepareBlock(SCRIPT_PUB);