mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: start BLS thread in LLMQContext
ctor, move Start
downwards
Alternate fix as proposed in dash#5752, needed because dependencies for threaded logic will be pulled out of ctor in upcoming commits and that needs `Start` to be pushed downwards so we can avoid having to pass `unique_ptr` references.
This commit is contained in:
parent
1e55310232
commit
cc0e771c29
@ -1906,8 +1906,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
*node.mempool, node.mn_activeman.get(), *node.mn_sync, node.peerman, /* unit_tests = */ false, /* wipe = */ fReset || fReindexChainState);
|
*node.mempool, node.mn_activeman.get(), *node.mn_sync, node.peerman, /* unit_tests = */ false, /* wipe = */ fReset || fReindexChainState);
|
||||||
// Enable CMNHFManager::{Process, Undo}Block
|
// Enable CMNHFManager::{Process, Undo}Block
|
||||||
node.mnhf_manager->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get());
|
node.mnhf_manager->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get());
|
||||||
// Have to start it early to let VerifyDB check ChainLock signatures in coinbase
|
|
||||||
node.llmq_ctx->Start();
|
|
||||||
|
|
||||||
node.chain_helper.reset();
|
node.chain_helper.reset();
|
||||||
node.chain_helper = std::make_unique<CChainstateHelper>(*node.cpoolman, *node.dmnman, *node.mnhf_manager, *node.govman, *(node.llmq_ctx->quorum_block_processor), *node.chainman,
|
node.chain_helper = std::make_unique<CChainstateHelper>(*node.cpoolman, *node.dmnman, *node.mnhf_manager, *node.govman, *(node.llmq_ctx->quorum_block_processor), *node.chainman,
|
||||||
@ -2282,6 +2280,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
|
|
||||||
// ********************************************************* Step 10a: schedule Dash-specific tasks
|
// ********************************************************* Step 10a: schedule Dash-specific tasks
|
||||||
|
|
||||||
|
node.llmq_ctx->Start();
|
||||||
|
|
||||||
node.scheduler->scheduleEvery(std::bind(&CNetFulfilledRequestManager::DoMaintenance, std::ref(*node.netfulfilledman)), std::chrono::minutes{1});
|
node.scheduler->scheduleEvery(std::bind(&CNetFulfilledRequestManager::DoMaintenance, std::ref(*node.netfulfilledman)), std::chrono::minutes{1});
|
||||||
node.scheduler->scheduleEvery(std::bind(&CMasternodeSync::DoMaintenance, std::ref(*node.mn_sync), std::cref(*node.peerman), std::cref(*node.govman)), std::chrono::seconds{1});
|
node.scheduler->scheduleEvery(std::bind(&CMasternodeSync::DoMaintenance, std::ref(*node.mn_sync), std::cref(*node.peerman), std::cref(*node.govman)), std::chrono::seconds{1});
|
||||||
node.scheduler->scheduleEvery(std::bind(&CMasternodeUtils::DoMaintenance, std::ref(*node.connman), std::ref(*node.dmnman), std::ref(*node.mn_sync), std::ref(*node.cj_ctx)), std::chrono::minutes{1});
|
node.scheduler->scheduleEvery(std::bind(&CMasternodeUtils::DoMaintenance, std::ref(*node.connman), std::ref(*node.dmnman), std::ref(*node.mn_sync), std::ref(*node.cj_ctx)), std::chrono::minutes{1});
|
||||||
|
@ -54,9 +54,13 @@ LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterm
|
|||||||
}()},
|
}()},
|
||||||
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainman, mnhfman, *sigman, *shareman, *qman)}
|
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainman, mnhfman, *sigman, *shareman, *qman)}
|
||||||
{
|
{
|
||||||
|
// Have to start it early to let VerifyDB check ChainLock signatures in coinbase
|
||||||
|
bls_worker->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLMQContext::~LLMQContext() {
|
LLMQContext::~LLMQContext() {
|
||||||
|
bls_worker->Stop();
|
||||||
|
|
||||||
// LLMQContext doesn't own these objects, but still need to care of them for consistency:
|
// LLMQContext doesn't own these objects, but still need to care of them for consistency:
|
||||||
llmq::quorumInstantSendManager.reset();
|
llmq::quorumInstantSendManager.reset();
|
||||||
llmq::chainLocksHandler.reset();
|
llmq::chainLocksHandler.reset();
|
||||||
@ -74,7 +78,6 @@ void LLMQContext::Start() {
|
|||||||
assert(clhandler == llmq::chainLocksHandler.get());
|
assert(clhandler == llmq::chainLocksHandler.get());
|
||||||
assert(isman == llmq::quorumInstantSendManager.get());
|
assert(isman == llmq::quorumInstantSendManager.get());
|
||||||
|
|
||||||
bls_worker->Start();
|
|
||||||
if (is_masternode) {
|
if (is_masternode) {
|
||||||
qdkgsman->StartThreads();
|
qdkgsman->StartThreads();
|
||||||
}
|
}
|
||||||
@ -101,5 +104,4 @@ void LLMQContext::Stop() {
|
|||||||
if (is_masternode) {
|
if (is_masternode) {
|
||||||
qdkgsman->StopThreads();
|
qdkgsman->StopThreads();
|
||||||
}
|
}
|
||||||
bls_worker->Stop();
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user