Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.cpp
Show All 24 Lines | |||||
#include <script/scriptcache.h> | #include <script/scriptcache.h> | ||||
#include <script/sigcache.h> | #include <script/sigcache.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <txdb.h> | #include <txdb.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/time.h> | #include <util/time.h> | ||||
#include <util/translation.h> | #include <util/translation.h> | ||||
#include <util/validation.h> | |||||
#include <validation.h> | #include <validation.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
#include <walletinitinterface.h> | #include <walletinitinterface.h> | ||||
#include <functional> | #include <functional> | ||||
#include <memory> | #include <memory> | ||||
const std::function<std::string(const char *)> G_TRANSLATION_FUN = nullptr; | const std::function<std::string(const char *)> G_TRANSLATION_FUN = nullptr; | ||||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | TestingSetup::TestingSetup(const std::string &chainName) | ||||
::ChainstateActive().InitCoinsCache(); | ::ChainstateActive().InitCoinsCache(); | ||||
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(strprintf("ActivateBestChain failed. (%s)", | throw std::runtime_error( | ||||
FormatStateMessage(state))); | strprintf("ActivateBestChain failed. (%s)", state.ToString())); | ||||
} | } | ||||
} | } | ||||
constexpr int script_check_threads = 2; | constexpr int script_check_threads = 2; | ||||
for (int i = 0; i < script_check_threads; ++i) { | for (int i = 0; i < script_check_threads; ++i) { | ||||
threadGroup.create_thread([i]() { return ThreadScriptCheck(i); }); | threadGroup.create_thread([i]() { return ThreadScriptCheck(i); }); | ||||
} | } | ||||
m_node.mempool = &::g_mempool; | m_node.mempool = &::g_mempool; | ||||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |