MCPcopy Create free account
hub / github.com/ElementsProject/elements / ChainTestingSetup

Method ChainTestingSetup

src/test/util/setup_common.cpp:174–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::string& fedpegscript, const std::vector<const char*>& extra_args)
175 : BasicTestingSetup(chainName, fedpegscript, extra_args)
176{
177 // We have to run a scheduler thread to prevent ActivateBestChain
178 // from blocking due to queue overrun.
179 m_node.scheduler = std::make_unique<CScheduler>();
180 m_node.scheduler->m_service_thread = std::thread(util::TraceThread, "scheduler", [&] { m_node.scheduler->serviceQueue(); });
181 GetMainSignals().RegisterBackgroundSignalScheduler(*m_node.scheduler);
182
183 m_node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
184 m_node.mempool = std::make_unique<CTxMemPool>(m_node.fee_estimator.get(), 1);
185
186 m_cache_sizes = CalculateCacheSizes(m_args);
187
188 m_node.chainman = std::make_unique<ChainstateManager>();
189 m_node.chainman->m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(m_cache_sizes.block_tree_db, true);
190
191 // Start script-checking threads. Set g_parallel_script_checks to true so they are used.
192 constexpr int script_check_threads = 2;
193 StartScriptCheckWorkerThreads(script_check_threads);
194 g_parallel_script_checks = true;
195}
196
197ChainTestingSetup::~ChainTestingSetup()
198{

Callers

nothing calls this directly

Calls 5

CalculateCacheSizesFunction · 0.85
serviceQueueMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected