From a14e604064b97c16629761d11ccfc5577d682f0d Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:19:25 +0000 Subject: [PATCH] refactor: remove `CConnman`, `PeerManager` from `LLMQContext` ctor --- src/init.cpp | 4 ++-- src/llmq/context.cpp | 7 +++---- src/llmq/context.h | 6 +++--- src/test/util/setup_common.cpp | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 4e5bda3e78..8f856ad586 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1902,8 +1902,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) node.llmq_ctx->Stop(); } node.llmq_ctx.reset(); - node.llmq_ctx = std::make_unique(chainman, *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, - *node.mempool, node.mn_activeman.get(), *node.mn_sync, node.peerman, /* unit_tests = */ false, /* wipe = */ fReset || fReindexChainState); + node.llmq_ctx = std::make_unique(chainman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, + *node.mempool, node.mn_activeman.get(), *node.mn_sync, /*unit_tests=*/false, /*wipe=*/fReset || fReindexChainState); // Enable CMNHFManager::{Process, Undo}Block node.mnhf_manager->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get()); diff --git a/src/llmq/context.cpp b/src/llmq/context.cpp index 51c3276c4b..8e8307b5c5 100644 --- a/src/llmq/context.cpp +++ b/src/llmq/context.cpp @@ -18,11 +18,10 @@ #include #include -LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, - CEvoDB& evo_db, CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, +LLMQContext::LLMQContext(ChainstateManager& chainman, CDeterministicMNManager& dmnman, CEvoDB& evo_db, + CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman, - const CMasternodeSync& mn_sync, const std::unique_ptr& peerman, bool unit_tests, - bool wipe) : + const CMasternodeSync& mn_sync, bool unit_tests, bool wipe) : is_masternode{mn_activeman != nullptr}, bls_worker{std::make_shared()}, dkg_debugman{std::make_unique()}, diff --git a/src/llmq/context.h b/src/llmq/context.h index adde61b89c..0e92e6a90f 100644 --- a/src/llmq/context.h +++ b/src/llmq/context.h @@ -39,10 +39,10 @@ private: public: LLMQContext() = delete; LLMQContext(const LLMQContext&) = delete; - LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, CEvoDB& evo_db, + LLMQContext(ChainstateManager& chainman, CDeterministicMNManager& dmnman, CEvoDB& evo_db, CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, CTxMemPool& mempool, - const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync, - const std::unique_ptr& peerman, bool unit_tests, bool wipe); + const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync, bool unit_tests, + bool wipe); ~LLMQContext(); void Interrupt(); diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 25b355ef71..ccf13074ce 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -111,12 +111,12 @@ void DashTestSetup(NodeContext& node, const CChainParams& chainparams) node.mempool->ConnectManagers(node.dmnman.get()); node.cj_ctx = std::make_unique(*node.chainman, *node.connman, *node.dmnman, *node.mn_metaman, *node.mempool, - /* mn_activeman = */ nullptr, *node.mn_sync, node.peerman, /* relay_txes = */ true); + /*mn_activeman=*/nullptr, *node.mn_sync, node.peerman, /*relay_txes=*/true); #ifdef ENABLE_WALLET node.coinjoin_loader = interfaces::MakeCoinJoinLoader(*node.cj_ctx->walletman); #endif // ENABLE_WALLET - node.llmq_ctx = std::make_unique(*node.chainman, *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, *node.mempool, - /* mn_activeman = */ nullptr, *node.mn_sync, node.peerman, /* unit_tests = */ true, /* wipe = */ false); + node.llmq_ctx = std::make_unique(*node.chainman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, *node.mempool, + /*mn_activeman=*/nullptr, *node.mn_sync, /*unit_tests=*/true, /*wipe=*/false); Assert(node.mnhf_manager)->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get()); node.chain_helper = std::make_unique(*node.cpoolman, *node.dmnman, *node.mnhf_manager, *node.govman, *(node.llmq_ctx->quorum_block_processor), *node.chainman, chainparams.GetConsensus(), *node.mn_sync, *node.sporkman, *(node.llmq_ctx->clhandler), *(node.llmq_ctx->qman));