Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.cpp
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | BasicTestingSetup::BasicTestingSetup( | ||||
: m_path_root{fs::temp_directory_path() / "test_common_" PACKAGE_NAME / | : m_path_root{fs::temp_directory_path() / "test_common_" PACKAGE_NAME / | ||||
g_insecure_rand_ctx_temp_path.rand256().ToString()} { | g_insecure_rand_ctx_temp_path.rand256().ToString()} { | ||||
// clang-format off | // clang-format off | ||||
std::vector<const char *> arguments = Cat( | std::vector<const char *> arguments = Cat( | ||||
{ | { | ||||
"dummy", | "dummy", | ||||
"-printtoconsole=0", | "-printtoconsole=0", | ||||
"-logtimemicros", | "-logtimemicros", | ||||
"-logthreadnames", | |||||
"-debug", | "-debug", | ||||
"-debugexclude=libevent", | "-debugexclude=libevent", | ||||
"-debugexclude=leveldb", | "-debugexclude=leveldb", | ||||
"-ecash", | "-ecash", | ||||
}, | }, | ||||
extra_args); | extra_args); | ||||
// clang-format on | // clang-format on | ||||
arguments = Cat(arguments, fixture_extra_args); | arguments = Cat(arguments, fixture_extra_args); | ||||
util::ThreadRename("test"); | |||||
auto &config = const_cast<Config &>(GetConfig()); | auto &config = const_cast<Config &>(GetConfig()); | ||||
SetMockTime(0); | SetMockTime(0); | ||||
fs::create_directories(m_path_root); | fs::create_directories(m_path_root); | ||||
gArgs.ForceSetArg("-datadir", m_path_root.string()); | gArgs.ForceSetArg("-datadir", m_path_root.string()); | ||||
ClearDatadirCache(); | ClearDatadirCache(); | ||||
{ | { | ||||
SetupServerArgs(m_node); | SetupServerArgs(m_node); | ||||
std::string error; | std::string error; | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | TestingSetup::TestingSetup(const std::string &chainName, | ||||
if (RPCIsInWarmup(&rpcWarmupStatus)) { | if (RPCIsInWarmup(&rpcWarmupStatus)) { | ||||
SetRPCWarmupFinished(); | SetRPCWarmupFinished(); | ||||
} | } | ||||
m_node.scheduler = std::make_unique<CScheduler>(); | m_node.scheduler = std::make_unique<CScheduler>(); | ||||
// We have to run a scheduler thread to prevent ActivateBestChain | // We have to run a scheduler thread to prevent ActivateBestChain | ||||
// from blocking due to queue overrun. | // from blocking due to queue overrun. | ||||
threadGroup.create_thread([&] { m_node.scheduler->serviceQueue(); }); | threadGroup.create_thread([&] { | ||||
TraceThread("scheduler", [&] { m_node.scheduler->serviceQueue(); }); | |||||
}); | |||||
GetMainSignals().RegisterBackgroundSignalScheduler(*m_node.scheduler); | GetMainSignals().RegisterBackgroundSignalScheduler(*m_node.scheduler); | ||||
pblocktree.reset(new CBlockTreeDB(1 << 20, true)); | pblocktree.reset(new CBlockTreeDB(1 << 20, true)); | ||||
m_node.mempool = std::make_unique<CTxMemPool>(); | m_node.mempool = std::make_unique<CTxMemPool>(); | ||||
m_node.mempool->setSanityCheck(1.0); | m_node.mempool->setSanityCheck(1.0); | ||||
m_node.chainman = &::g_chainman; | m_node.chainman = &::g_chainman; | ||||
▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines |