aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2019-02-15 10:41:48 +0100
committerpracticalswift <practicalswift@users.noreply.github.com>2019-02-15 10:41:52 +0100
commit543ef7d626177a5cc4e0f5c7f01bca0946782d1c (patch)
tree555da7db84222843ae03bfaa8f2667dd848ce71e /src/bench
parentc576979b78b541bf3b4a7cbeee989b55d268e3e1 (diff)
downloadbitcoin-543ef7d626177a5cc4e0f5c7f01bca0946782d1c.tar.xz
tests: Add missing cs_main locks required when accessing pcoinsdbview, pcoinsTip or pblocktree
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/block_assemble.cpp4
-rw-r--r--src/bench/duplicate_inputs.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/bench/block_assemble.cpp b/src/bench/block_assemble.cpp
index 8133fd9d65..cd4543c012 100644
--- a/src/bench/block_assemble.cpp
+++ b/src/bench/block_assemble.cpp
@@ -73,10 +73,12 @@ static void AssembleBlock(benchmark::State& state)
boost::thread_group thread_group;
CScheduler scheduler;
{
+ LOCK(cs_main);
::pblocktree.reset(new CBlockTreeDB(1 << 20, true));
::pcoinsdbview.reset(new CCoinsViewDB(1 << 23, true));
::pcoinsTip.reset(new CCoinsViewCache(pcoinsdbview.get()));
-
+ }
+ {
const CChainParams& chainparams = Params();
thread_group.create_thread(std::bind(&CScheduler::serviceQueue, &scheduler));
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
diff --git a/src/bench/duplicate_inputs.cpp b/src/bench/duplicate_inputs.cpp
index e0854e2c62..1f6840d813 100644
--- a/src/bench/duplicate_inputs.cpp
+++ b/src/bench/duplicate_inputs.cpp
@@ -37,10 +37,12 @@ static void DuplicateInputs(benchmark::State& state)
CScheduler scheduler;
const CChainParams& chainparams = Params();
{
+ LOCK(cs_main);
::pblocktree.reset(new CBlockTreeDB(1 << 20, true));
::pcoinsdbview.reset(new CCoinsViewDB(1 << 23, true));
::pcoinsTip.reset(new CCoinsViewCache(pcoinsdbview.get()));
-
+ }
+ {
thread_group.create_thread(std::bind(&CScheduler::serviceQueue, &scheduler));
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
LoadGenesisBlock(chainparams);