Skip to content

Commit cc0e771

Browse files
committed
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.
1 parent 1e55310 commit cc0e771

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,8 +1906,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
19061906
*node.mempool, node.mn_activeman.get(), *node.mn_sync, node.peerman, /* unit_tests = */ false, /* wipe = */ fReset || fReindexChainState);
19071907
// Enable CMNHFManager::{Process, Undo}Block
19081908
node.mnhf_manager->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get());
1909-
// Have to start it early to let VerifyDB check ChainLock signatures in coinbase
1910-
node.llmq_ctx->Start();
19111909

19121910
node.chain_helper.reset();
19131911
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)
22822280

22832281
// ********************************************************* Step 10a: schedule Dash-specific tasks
22842282

2283+
node.llmq_ctx->Start();
2284+
22852285
node.scheduler->scheduleEvery(std::bind(&CNetFulfilledRequestManager::DoMaintenance, std::ref(*node.netfulfilledman)), std::chrono::minutes{1});
22862286
node.scheduler->scheduleEvery(std::bind(&CMasternodeSync::DoMaintenance, std::ref(*node.mn_sync), std::cref(*node.peerman), std::cref(*node.govman)), std::chrono::seconds{1});
22872287
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});

src/llmq/context.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterm
5454
}()},
5555
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainman, mnhfman, *sigman, *shareman, *qman)}
5656
{
57+
// Have to start it early to let VerifyDB check ChainLock signatures in coinbase
58+
bls_worker->Start();
5759
}
5860

5961
LLMQContext::~LLMQContext() {
62+
bls_worker->Stop();
63+
6064
// LLMQContext doesn't own these objects, but still need to care of them for consistency:
6165
llmq::quorumInstantSendManager.reset();
6266
llmq::chainLocksHandler.reset();
@@ -74,7 +78,6 @@ void LLMQContext::Start() {
7478
assert(clhandler == llmq::chainLocksHandler.get());
7579
assert(isman == llmq::quorumInstantSendManager.get());
7680

77-
bls_worker->Start();
7881
if (is_masternode) {
7982
qdkgsman->StartThreads();
8083
}
@@ -101,5 +104,4 @@ void LLMQContext::Stop() {
101104
if (is_masternode) {
102105
qdkgsman->StopThreads();
103106
}
104-
bls_worker->Stop();
105107
}

0 commit comments

Comments
 (0)