refactor: move CConnman out of CDKGSession{,Handler,Manager} ctor

This commit is contained in:
Kittywhiskers Van Gogh 2024-11-30 10:03:40 +00:00
parent 01876c7e56
commit c07b522baa
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
9 changed files with 51 additions and 58 deletions

View File

@ -2280,7 +2280,7 @@ 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.peerman); node.llmq_ctx->Start(*node.connman, *node.peerman);
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});

View File

@ -27,9 +27,9 @@ LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterm
bls_worker{std::make_shared<CBLSWorker>()}, bls_worker{std::make_shared<CBLSWorker>()},
dkg_debugman{std::make_unique<llmq::CDKGDebugManager>()}, dkg_debugman{std::make_unique<llmq::CDKGDebugManager>()},
quorum_block_processor{std::make_unique<llmq::CQuorumBlockProcessor>(chainman.ActiveChainstate(), dmnman, evo_db)}, quorum_block_processor{std::make_unique<llmq::CQuorumBlockProcessor>(chainman.ActiveChainstate(), dmnman, evo_db)},
qdkgsman{std::make_unique<llmq::CDKGSessionManager>(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, qdkgsman{std::make_unique<llmq::CDKGSessionManager>(*bls_worker, chainman.ActiveChainstate(), dmnman, *dkg_debugman,
*dkg_debugman, mn_metaman, *quorum_block_processor, mn_metaman, *quorum_block_processor, mn_activeman, sporkman,
mn_activeman, sporkman, unit_tests, wipe)}, unit_tests, wipe)},
qman{std::make_unique<llmq::CQuorumManager>(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, *qdkgsman, qman{std::make_unique<llmq::CQuorumManager>(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, *qdkgsman,
evo_db, *quorum_block_processor, mn_activeman, mn_sync, sporkman, evo_db, *quorum_block_processor, mn_activeman, mn_sync, sporkman,
unit_tests, wipe)}, unit_tests, wipe)},
@ -74,13 +74,13 @@ void LLMQContext::Interrupt() {
llmq::quorumInstantSendManager->InterruptWorkerThread(); llmq::quorumInstantSendManager->InterruptWorkerThread();
} }
void LLMQContext::Start(PeerManager& peerman) void LLMQContext::Start(CConnman& connman, PeerManager& peerman)
{ {
assert(clhandler == llmq::chainLocksHandler.get()); assert(clhandler == llmq::chainLocksHandler.get());
assert(isman == llmq::quorumInstantSendManager.get()); assert(isman == llmq::quorumInstantSendManager.get());
if (is_masternode) { if (is_masternode) {
qdkgsman->StartThreads(peerman); qdkgsman->StartThreads(connman, peerman);
} }
qman->Start(); qman->Start();
shareman->RegisterAsRecoveredSigsListener(); shareman->RegisterAsRecoveredSigsListener();

View File

@ -46,7 +46,7 @@ public:
~LLMQContext(); ~LLMQContext();
void Interrupt(); void Interrupt();
void Start(PeerManager& peerman); void Start(CConnman& connman, PeerManager& peerman);
void Stop(); void Stop();
/** Guaranteed if LLMQContext is initialized then all members are valid too /** Guaranteed if LLMQContext is initialized then all members are valid too

View File

@ -72,14 +72,12 @@ CDKGMember::CDKGMember(const CDeterministicMNCPtr& _dmn, size_t _idx) :
} }
CDKGSession::CDKGSession(const CBlockIndex* pQuorumBaseBlockIndex, const Consensus::LLMQParams& _params, CDKGSession::CDKGSession(const CBlockIndex* pQuorumBaseBlockIndex, const Consensus::LLMQParams& _params,
CBLSWorker& _blsWorker, CConnman& _connman, CDeterministicMNManager& dmnman, CBLSWorker& _blsWorker, CDeterministicMNManager& dmnman, CDKGSessionManager& _dkgManager,
CDKGSessionManager& _dkgManager, CDKGDebugManager& _dkgDebugManager, CDKGDebugManager& _dkgDebugManager, CMasternodeMetaMan& mn_metaman,
CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman, const CActiveMasternodeManager* const mn_activeman, const CSporkManager& sporkman) :
const CSporkManager& sporkman) :
params(_params), params(_params),
blsWorker(_blsWorker), blsWorker(_blsWorker),
cache(_blsWorker), cache(_blsWorker),
connman(_connman),
m_dmnman(dmnman), m_dmnman(dmnman),
dkgManager(_dkgManager), dkgManager(_dkgManager),
dkgDebugManager(_dkgDebugManager), dkgDebugManager(_dkgDebugManager),
@ -417,7 +415,7 @@ void CDKGSession::VerifyPendingContributions()
pendingContributionVerifications.clear(); pendingContributionVerifications.clear();
} }
void CDKGSession::VerifyAndComplain(CDKGPendingMessages& pendingMessages, PeerManager& peerman) void CDKGSession::VerifyAndComplain(CConnman& connman, CDKGPendingMessages& pendingMessages, PeerManager& peerman)
{ {
if (!AreWeMember()) { if (!AreWeMember()) {
return; return;
@ -453,12 +451,12 @@ void CDKGSession::VerifyAndComplain(CDKGPendingMessages& pendingMessages, PeerMa
logger.Batch("verified contributions. time=%d", t1.count()); logger.Batch("verified contributions. time=%d", t1.count());
logger.Flush(); logger.Flush();
VerifyConnectionAndMinProtoVersions(); VerifyConnectionAndMinProtoVersions(connman);
SendComplaint(pendingMessages, peerman); SendComplaint(pendingMessages, peerman);
} }
void CDKGSession::VerifyConnectionAndMinProtoVersions() const void CDKGSession::VerifyConnectionAndMinProtoVersions(CConnman& connman) const
{ {
assert(m_mn_metaman.IsValid()); assert(m_mn_metaman.IsValid());

View File

@ -280,7 +280,6 @@ private:
CBLSWorker& blsWorker; CBLSWorker& blsWorker;
CBLSWorkerCache cache; CBLSWorkerCache cache;
CConnman& connman;
CDeterministicMNManager& m_dmnman; CDeterministicMNManager& m_dmnman;
CDKGSessionManager& dkgManager; CDKGSessionManager& dkgManager;
CDKGDebugManager& dkgDebugManager; CDKGDebugManager& dkgDebugManager;
@ -327,9 +326,9 @@ private:
public: public:
CDKGSession(const CBlockIndex* pQuorumBaseBlockIndex, const Consensus::LLMQParams& _params, CBLSWorker& _blsWorker, CDKGSession(const CBlockIndex* pQuorumBaseBlockIndex, const Consensus::LLMQParams& _params, CBLSWorker& _blsWorker,
CConnman& _connman, CDeterministicMNManager& dmnman, CDKGSessionManager& _dkgManager, CDeterministicMNManager& dmnman, CDKGSessionManager& _dkgManager, CDKGDebugManager& _dkgDebugManager,
CDKGDebugManager& _dkgDebugManager, CMasternodeMetaMan& mn_metaman, CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman,
const CActiveMasternodeManager* const mn_activeman, const CSporkManager& sporkman); const CSporkManager& sporkman);
// TODO: remove Init completely // TODO: remove Init completely
bool Init(const uint256& _myProTxHash, int _quorumIndex); bool Init(const uint256& _myProTxHash, int _quorumIndex);
@ -357,8 +356,8 @@ public:
void VerifyPendingContributions() EXCLUSIVE_LOCKS_REQUIRED(cs_pending); void VerifyPendingContributions() EXCLUSIVE_LOCKS_REQUIRED(cs_pending);
// Phase 2: complaint // Phase 2: complaint
void VerifyAndComplain(CDKGPendingMessages& pendingMessages, PeerManager& peerman); void VerifyAndComplain(CConnman& connman, CDKGPendingMessages& pendingMessages, PeerManager& peerman);
void VerifyConnectionAndMinProtoVersions() const; void VerifyConnectionAndMinProtoVersions(CConnman& connman) const;
void SendComplaint(CDKGPendingMessages& pendingMessages, PeerManager& peerman); void SendComplaint(CDKGPendingMessages& pendingMessages, PeerManager& peerman);
bool PreVerifyMessage(const CDKGComplaint& qc, bool& retBan) const; bool PreVerifyMessage(const CDKGComplaint& qc, bool& retBan) const;
std::optional<CInv> ReceiveMessage(const CDKGComplaint& qc); std::optional<CInv> ReceiveMessage(const CDKGComplaint& qc);

View File

@ -24,15 +24,13 @@
namespace llmq namespace llmq
{ {
CDKGSessionHandler::CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGSessionHandler::CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chainstate, CDeterministicMNManager& dmnman,
CDeterministicMNManager& dmnman, CDKGDebugManager& _dkgDebugManager, CDKGDebugManager& _dkgDebugManager, CDKGSessionManager& _dkgManager,
CDKGSessionManager& _dkgManager, CMasternodeMetaMan& mn_metaman, CMasternodeMetaMan& mn_metaman, CQuorumBlockProcessor& _quorumBlockProcessor,
CQuorumBlockProcessor& _quorumBlockProcessor,
const CActiveMasternodeManager* const mn_activeman, const CSporkManager& sporkman, const CActiveMasternodeManager* const mn_activeman, const CSporkManager& sporkman,
const Consensus::LLMQParams& _params, int _quorumIndex) : const Consensus::LLMQParams& _params, int _quorumIndex) :
blsWorker(_blsWorker), blsWorker(_blsWorker),
m_chainstate(chainstate), m_chainstate(chainstate),
connman(_connman),
m_dmnman(dmnman), m_dmnman(dmnman),
dkgDebugManager(_dkgDebugManager), dkgDebugManager(_dkgDebugManager),
dkgManager(_dkgManager), dkgManager(_dkgManager),
@ -42,8 +40,8 @@ CDKGSessionHandler::CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chai
m_sporkman(sporkman), m_sporkman(sporkman),
params(_params), params(_params),
quorumIndex(_quorumIndex), quorumIndex(_quorumIndex),
curSession(std::make_unique<CDKGSession>(nullptr, _params, _blsWorker, _connman, dmnman, _dkgManager, curSession(std::make_unique<CDKGSession>(nullptr, _params, _blsWorker, dmnman, _dkgManager, _dkgDebugManager,
_dkgDebugManager, m_mn_metaman, m_mn_activeman, sporkman)), m_mn_metaman, m_mn_activeman, sporkman)),
pendingContributions( pendingContributions(
(size_t)_params.size * 2, (size_t)_params.size * 2,
MSG_QUORUM_CONTRIB), // we allow size*2 messages as we need to make sure we see bad behavior (double messages) MSG_QUORUM_CONTRIB), // we allow size*2 messages as we need to make sure we see bad behavior (double messages)
@ -165,7 +163,7 @@ void CDKGSessionHandler::ProcessMessage(const CNode& pfrom, PeerManager& peerman
} }
} }
void CDKGSessionHandler::StartThread(PeerManager& peerman) void CDKGSessionHandler::StartThread(CConnman& connman, PeerManager& peerman)
{ {
if (phaseHandlerThread.joinable()) { if (phaseHandlerThread.joinable()) {
throw std::runtime_error("Tried to start an already started CDKGSessionHandler thread."); throw std::runtime_error("Tried to start an already started CDKGSessionHandler thread.");
@ -173,7 +171,7 @@ void CDKGSessionHandler::StartThread(PeerManager& peerman)
m_thread_name = strprintf("llmq-%d-%d", ToUnderlying(params.type), quorumIndex); m_thread_name = strprintf("llmq-%d-%d", ToUnderlying(params.type), quorumIndex);
phaseHandlerThread = std::thread(&util::TraceThread, m_thread_name.c_str(), phaseHandlerThread = std::thread(&util::TraceThread, m_thread_name.c_str(),
[this, &peerman] { PhaseHandlerThread(peerman); }); [this, &connman, &peerman] { PhaseHandlerThread(connman, peerman); });
} }
void CDKGSessionHandler::StopThread() void CDKGSessionHandler::StopThread()
@ -190,7 +188,7 @@ bool CDKGSessionHandler::InitNewQuorum(const CBlockIndex* pQuorumBaseBlockIndex)
return false; return false;
} }
curSession = std::make_unique<CDKGSession>(pQuorumBaseBlockIndex, params, blsWorker, connman, m_dmnman, dkgManager, curSession = std::make_unique<CDKGSession>(pQuorumBaseBlockIndex, params, blsWorker, m_dmnman, dkgManager,
dkgDebugManager, m_mn_metaman, m_mn_activeman, m_sporkman); dkgDebugManager, m_mn_metaman, m_mn_activeman, m_sporkman);
if (!curSession->Init(m_mn_activeman->GetProTxHash(), quorumIndex)) { if (!curSession->Init(m_mn_activeman->GetProTxHash(), quorumIndex)) {
@ -528,7 +526,7 @@ bool ProcessPendingMessageBatch(CConnman& connman, CDKGSession& session, CDKGPen
return true; return true;
} }
void CDKGSessionHandler::HandleDKGRound(PeerManager& peerman) void CDKGSessionHandler::HandleDKGRound(CConnman& connman, PeerManager& peerman)
{ {
WaitForNextPhase(std::nullopt, QuorumPhase::Initialized); WaitForNextPhase(std::nullopt, QuorumPhase::Initialized);
@ -562,15 +560,17 @@ void CDKGSessionHandler::HandleDKGRound(PeerManager& peerman)
// Contribute // Contribute
auto fContributeStart = [this, &peerman]() { curSession->Contribute(pendingContributions, peerman); }; auto fContributeStart = [this, &peerman]() { curSession->Contribute(pendingContributions, peerman); };
auto fContributeWait = [this, &peerman] { auto fContributeWait = [this, &connman, &peerman] {
return ProcessPendingMessageBatch<CDKGContribution, MSG_QUORUM_CONTRIB>(connman, *curSession, return ProcessPendingMessageBatch<CDKGContribution, MSG_QUORUM_CONTRIB>(connman, *curSession,
pendingContributions, peerman, 8); pendingContributions, peerman, 8);
}; };
HandlePhase(QuorumPhase::Contribute, QuorumPhase::Complain, curQuorumHash, 0.05, fContributeStart, fContributeWait); HandlePhase(QuorumPhase::Contribute, QuorumPhase::Complain, curQuorumHash, 0.05, fContributeStart, fContributeWait);
// Complain // Complain
auto fComplainStart = [this, &peerman]() { curSession->VerifyAndComplain(pendingComplaints, peerman); }; auto fComplainStart = [this, &connman, &peerman]() {
auto fComplainWait = [this, &peerman] { curSession->VerifyAndComplain(connman, pendingComplaints, peerman);
};
auto fComplainWait = [this, &connman, &peerman] {
return ProcessPendingMessageBatch<CDKGComplaint, MSG_QUORUM_COMPLAINT>(connman, *curSession, pendingComplaints, return ProcessPendingMessageBatch<CDKGComplaint, MSG_QUORUM_COMPLAINT>(connman, *curSession, pendingComplaints,
peerman, 8); peerman, 8);
}; };
@ -578,7 +578,7 @@ void CDKGSessionHandler::HandleDKGRound(PeerManager& peerman)
// Justify // Justify
auto fJustifyStart = [this, &peerman]() { curSession->VerifyAndJustify(pendingJustifications, peerman); }; auto fJustifyStart = [this, &peerman]() { curSession->VerifyAndJustify(pendingJustifications, peerman); };
auto fJustifyWait = [this, &peerman] { auto fJustifyWait = [this, &connman, &peerman] {
return ProcessPendingMessageBatch<CDKGJustification, MSG_QUORUM_JUSTIFICATION>(connman, *curSession, return ProcessPendingMessageBatch<CDKGJustification, MSG_QUORUM_JUSTIFICATION>(connman, *curSession,
pendingJustifications, peerman, 8); pendingJustifications, peerman, 8);
}; };
@ -586,7 +586,7 @@ void CDKGSessionHandler::HandleDKGRound(PeerManager& peerman)
// Commit // Commit
auto fCommitStart = [this, &peerman]() { curSession->VerifyAndCommit(pendingPrematureCommitments, peerman); }; auto fCommitStart = [this, &peerman]() { curSession->VerifyAndCommit(pendingPrematureCommitments, peerman); };
auto fCommitWait = [this, &peerman] { auto fCommitWait = [this, &connman, &peerman] {
return ProcessPendingMessageBatch<CDKGPrematureCommitment, MSG_QUORUM_PREMATURE_COMMITMENT>( return ProcessPendingMessageBatch<CDKGPrematureCommitment, MSG_QUORUM_PREMATURE_COMMITMENT>(
connman, *curSession, pendingPrematureCommitments, peerman, 8); connman, *curSession, pendingPrematureCommitments, peerman, 8);
}; };
@ -600,12 +600,12 @@ void CDKGSessionHandler::HandleDKGRound(PeerManager& peerman)
} }
} }
void CDKGSessionHandler::PhaseHandlerThread(PeerManager& peerman) void CDKGSessionHandler::PhaseHandlerThread(CConnman& connman, PeerManager& peerman)
{ {
while (!stopRequested) { while (!stopRequested) {
try { try {
LogPrint(BCLog::LLMQ_DKG, "CDKGSessionHandler::%s -- %s qi[%d] - starting HandleDKGRound\n", __func__, params.name, quorumIndex); LogPrint(BCLog::LLMQ_DKG, "CDKGSessionHandler::%s -- %s qi[%d] - starting HandleDKGRound\n", __func__, params.name, quorumIndex);
HandleDKGRound(peerman); HandleDKGRound(connman, peerman);
} catch (AbortPhaseException& e) { } catch (AbortPhaseException& e) {
dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) {
status.statusBits.aborted = true; status.statusBits.aborted = true;

View File

@ -129,7 +129,6 @@ private:
CBLSWorker& blsWorker; CBLSWorker& blsWorker;
CChainState& m_chainstate; CChainState& m_chainstate;
CConnman& connman;
CDeterministicMNManager& m_dmnman; CDeterministicMNManager& m_dmnman;
CDKGDebugManager& dkgDebugManager; CDKGDebugManager& dkgDebugManager;
CDKGSessionManager& dkgManager; CDKGSessionManager& dkgManager;
@ -156,9 +155,8 @@ private:
CDKGPendingMessages pendingPrematureCommitments; CDKGPendingMessages pendingPrematureCommitments;
public: public:
CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chainstate, CDeterministicMNManager& dmnman,
CDeterministicMNManager& dmnman, CDKGDebugManager& _dkgDebugManager, CDKGDebugManager& _dkgDebugManager, CDKGSessionManager& _dkgManager, CMasternodeMetaMan& mn_metaman,
CDKGSessionManager& _dkgManager, CMasternodeMetaMan& mn_metaman,
CQuorumBlockProcessor& _quorumBlockProcessor, const CActiveMasternodeManager* const mn_activeman, CQuorumBlockProcessor& _quorumBlockProcessor, const CActiveMasternodeManager* const mn_activeman,
const CSporkManager& sporkman, const Consensus::LLMQParams& _params, int _quorumIndex); const CSporkManager& sporkman, const Consensus::LLMQParams& _params, int _quorumIndex);
~CDKGSessionHandler(); ~CDKGSessionHandler();
@ -166,7 +164,7 @@ public:
void UpdatedBlockTip(const CBlockIndex *pindexNew); void UpdatedBlockTip(const CBlockIndex *pindexNew);
void ProcessMessage(const CNode& pfrom, PeerManager& peerman, const std::string& msg_type, CDataStream& vRecv); void ProcessMessage(const CNode& pfrom, PeerManager& peerman, const std::string& msg_type, CDataStream& vRecv);
void StartThread(PeerManager& peerman); void StartThread(CConnman& connman, PeerManager& peerman);
void StopThread(); void StopThread();
bool GetContribution(const uint256& hash, CDKGContribution& ret) const; bool GetContribution(const uint256& hash, CDKGContribution& ret) const;
@ -191,8 +189,8 @@ private:
void WaitForNewQuorum(const uint256& oldQuorumHash) const; void WaitForNewQuorum(const uint256& oldQuorumHash) const;
void SleepBeforePhase(QuorumPhase curPhase, const uint256& expectedQuorumHash, double randomSleepFactor, const WhileWaitFunc& runWhileWaiting) const; void SleepBeforePhase(QuorumPhase curPhase, const uint256& expectedQuorumHash, double randomSleepFactor, const WhileWaitFunc& runWhileWaiting) const;
void HandlePhase(QuorumPhase curPhase, QuorumPhase nextPhase, const uint256& expectedQuorumHash, double randomSleepFactor, const StartPhaseFunc& startPhaseFunc, const WhileWaitFunc& runWhileWaiting); void HandlePhase(QuorumPhase curPhase, QuorumPhase nextPhase, const uint256& expectedQuorumHash, double randomSleepFactor, const StartPhaseFunc& startPhaseFunc, const WhileWaitFunc& runWhileWaiting);
void HandleDKGRound(PeerManager& peerman); void HandleDKGRound(CConnman& connman, PeerManager& peerman);
void PhaseHandlerThread(PeerManager& peerman); void PhaseHandlerThread(CConnman& connman, PeerManager& peerman);
}; };
} // namespace llmq } // namespace llmq

View File

@ -29,15 +29,14 @@ static const std::string DB_VVEC = "qdkg_V";
static const std::string DB_SKCONTRIB = "qdkg_S"; static const std::string DB_SKCONTRIB = "qdkg_S";
static const std::string DB_ENC_CONTRIB = "qdkg_E"; static const std::string DB_ENC_CONTRIB = "qdkg_E";
CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chainstate, CDeterministicMNManager& dmnman,
CDeterministicMNManager& dmnman, CDKGDebugManager& _dkgDebugManager, CDKGDebugManager& _dkgDebugManager, CMasternodeMetaMan& mn_metaman,
CMasternodeMetaMan& mn_metaman, CQuorumBlockProcessor& _quorumBlockProcessor, CQuorumBlockProcessor& _quorumBlockProcessor,
const CActiveMasternodeManager* const mn_activeman, const CActiveMasternodeManager* const mn_activeman,
const CSporkManager& sporkman, bool unitTests, bool fWipe) : const CSporkManager& sporkman, bool unitTests, bool fWipe) :
db(std::make_unique<CDBWrapper>(unitTests ? "" : (gArgs.GetDataDirNet() / "llmq/dkgdb"), 1 << 20, unitTests, fWipe)), db(std::make_unique<CDBWrapper>(unitTests ? "" : (gArgs.GetDataDirNet() / "llmq/dkgdb"), 1 << 20, unitTests, fWipe)),
blsWorker(_blsWorker), blsWorker(_blsWorker),
m_chainstate(chainstate), m_chainstate(chainstate),
connman(_connman),
m_dmnman(dmnman), m_dmnman(dmnman),
dkgDebugManager(_dkgDebugManager), dkgDebugManager(_dkgDebugManager),
quorumBlockProcessor(_quorumBlockProcessor), quorumBlockProcessor(_quorumBlockProcessor),
@ -53,8 +52,8 @@ CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chai
auto session_count = (params.useRotation) ? params.signingActiveQuorumCount : 1; auto session_count = (params.useRotation) ? params.signingActiveQuorumCount : 1;
for (const auto i : irange::range(session_count)) { for (const auto i : irange::range(session_count)) {
dkgSessionHandlers.emplace(std::piecewise_construct, std::forward_as_tuple(params.type, i), dkgSessionHandlers.emplace(std::piecewise_construct, std::forward_as_tuple(params.type, i),
std::forward_as_tuple(blsWorker, m_chainstate, connman, dmnman, dkgDebugManager, std::forward_as_tuple(blsWorker, m_chainstate, dmnman, dkgDebugManager, *this,
*this, mn_metaman, quorumBlockProcessor, mn_activeman, mn_metaman, quorumBlockProcessor, mn_activeman,
spork_manager, params, i)); spork_manager, params, i));
} }
} }
@ -62,10 +61,10 @@ CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chai
CDKGSessionManager::~CDKGSessionManager() = default; CDKGSessionManager::~CDKGSessionManager() = default;
void CDKGSessionManager::StartThreads(PeerManager& peerman) void CDKGSessionManager::StartThreads(CConnman& connman, PeerManager& peerman)
{ {
for (auto& it : dkgSessionHandlers) { for (auto& it : dkgSessionHandlers) {
it.second.StartThread(peerman); it.second.StartThread(connman, peerman);
} }
} }

View File

@ -42,7 +42,6 @@ private:
CBLSWorker& blsWorker; CBLSWorker& blsWorker;
CChainState& m_chainstate; CChainState& m_chainstate;
CConnman& connman;
CDeterministicMNManager& m_dmnman; CDeterministicMNManager& m_dmnman;
CDKGDebugManager& dkgDebugManager; CDKGDebugManager& dkgDebugManager;
CQuorumBlockProcessor& quorumBlockProcessor; CQuorumBlockProcessor& quorumBlockProcessor;
@ -71,13 +70,13 @@ private:
mutable std::map<ContributionsCacheKey, ContributionsCacheEntry> contributionsCache GUARDED_BY(contributionsCacheCs); mutable std::map<ContributionsCacheKey, ContributionsCacheEntry> contributionsCache GUARDED_BY(contributionsCacheCs);
public: public:
CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chainstate, CDeterministicMNManager& dmnman,
CDeterministicMNManager& dmnman, CDKGDebugManager& _dkgDebugManager, CMasternodeMetaMan& mn_metaman, CDKGDebugManager& _dkgDebugManager, CMasternodeMetaMan& mn_metaman,
CQuorumBlockProcessor& _quorumBlockProcessor, const CActiveMasternodeManager* const mn_activeman, CQuorumBlockProcessor& _quorumBlockProcessor, const CActiveMasternodeManager* const mn_activeman,
const CSporkManager& sporkman, bool unitTests, bool fWipe); const CSporkManager& sporkman, bool unitTests, bool fWipe);
~CDKGSessionManager(); ~CDKGSessionManager();
void StartThreads(PeerManager& peerman); void StartThreads(CConnman& connman, PeerManager& peerman);
void StopThreads(); void StopThreads();
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload); void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload);