Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.cpp
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | TestingSetup::TestingSetup(const std::string &chainName, | ||||
pblocktree.reset(new CBlockTreeDB(1 << 20, true)); | pblocktree.reset(new CBlockTreeDB(1 << 20, true)); | ||||
m_node.chainman = &::g_chainman; | m_node.chainman = &::g_chainman; | ||||
m_node.chainman->InitializeChainstate(); | m_node.chainman->InitializeChainstate(); | ||||
::ChainstateActive().InitCoinsDB( | ::ChainstateActive().InitCoinsDB( | ||||
/* cache_size_bytes */ 1 << 23, /* in_memory */ true, | /* cache_size_bytes */ 1 << 23, /* in_memory */ true, | ||||
/* should_wipe */ false); | /* should_wipe */ false); | ||||
assert(!::ChainstateActive().CanFlushToDisk()); | assert(!::ChainstateActive().CanFlushToDisk()); | ||||
::ChainstateActive().InitCoinsCache(); | ::ChainstateActive().InitCoinsCache(1 << 23); | ||||
assert(::ChainstateActive().CanFlushToDisk()); | assert(::ChainstateActive().CanFlushToDisk()); | ||||
if (!LoadGenesisBlock(chainparams)) { | if (!LoadGenesisBlock(chainparams)) { | ||||
throw std::runtime_error("LoadGenesisBlock failed."); | throw std::runtime_error("LoadGenesisBlock failed."); | ||||
} | } | ||||
{ | { | ||||
BlockValidationState state; | BlockValidationState state; | ||||
if (!ActivateBestChain(config, state)) { | if (!ActivateBestChain(config, state)) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |