mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
refactor: De-globalize g_signals
This commit is contained in:
@@ -171,7 +171,8 @@ ChainTestingSetup::ChainTestingSetup(const ChainType chainType, const std::vecto
|
||||
// from blocking due to queue overrun.
|
||||
m_node.scheduler = std::make_unique<CScheduler>();
|
||||
m_node.scheduler->m_service_thread = std::thread(util::TraceThread, "scheduler", [&] { m_node.scheduler->serviceQueue(); });
|
||||
GetMainSignals().RegisterBackgroundSignalScheduler(*m_node.scheduler);
|
||||
m_node.validation_signals = std::make_unique<CMainSignals>();
|
||||
m_node.validation_signals->RegisterBackgroundSignalScheduler(*m_node.scheduler);
|
||||
|
||||
m_node.fee_estimator = std::make_unique<CBlockPolicyEstimator>(FeeestPath(*m_node.args), DEFAULT_ACCEPT_STALE_FEE_ESTIMATES);
|
||||
m_node.mempool = std::make_unique<CTxMemPool>(MemPoolOptionsForTest(m_node));
|
||||
@@ -185,7 +186,7 @@ ChainTestingSetup::ChainTestingSetup(const ChainType chainType, const std::vecto
|
||||
.datadir = m_args.GetDataDirNet(),
|
||||
.check_block_index = true,
|
||||
.notifications = *m_node.notifications,
|
||||
.signals = &GetMainSignals(),
|
||||
.signals = m_node.validation_signals.get(),
|
||||
.worker_threads_num = 2,
|
||||
};
|
||||
const BlockManager::Options blockman_opts{
|
||||
@@ -203,8 +204,8 @@ ChainTestingSetup::ChainTestingSetup(const ChainType chainType, const std::vecto
|
||||
ChainTestingSetup::~ChainTestingSetup()
|
||||
{
|
||||
if (m_node.scheduler) m_node.scheduler->stop();
|
||||
GetMainSignals().FlushBackgroundCallbacks();
|
||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||
m_node.validation_signals->FlushBackgroundCallbacks();
|
||||
m_node.validation_signals->UnregisterBackgroundSignalScheduler();
|
||||
m_node.connman.reset();
|
||||
m_node.banman.reset();
|
||||
m_node.addrman.reset();
|
||||
@@ -213,6 +214,7 @@ ChainTestingSetup::~ChainTestingSetup()
|
||||
m_node.mempool.reset();
|
||||
m_node.fee_estimator.reset();
|
||||
m_node.chainman.reset();
|
||||
m_node.validation_signals.reset();
|
||||
m_node.scheduler.reset();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user