diff --git a/src/governance/classes.cpp b/src/governance/classes.cpp index 98850bf97a..b50bef71c7 100644 --- a/src/governance/classes.cpp +++ b/src/governance/classes.cpp @@ -365,16 +365,16 @@ bool CSuperblockManager::IsValid(CGovernanceManager& govman, const CChain& activ return false; } -void CSuperblockManager::ExecuteBestSuperblock(CGovernanceManager& govman, const CDeterministicMNList& tip_mn_list, int nBlockHeight) +void CGovernanceManager::ExecuteBestSuperblock(const CDeterministicMNList& tip_mn_list, int nBlockHeight) { - LOCK(govman.cs); + LOCK(cs); CSuperblock_sptr pSuperblock; - if (GetBestSuperblock(govman, tip_mn_list, pSuperblock, nBlockHeight)) { + if (CSuperblockManager::GetBestSuperblock(*this, tip_mn_list, pSuperblock, nBlockHeight)) { // All checks are done in CSuperblock::IsValid via IsBlockValueValid and IsBlockPayeeValid, // tip wouldn't be updated if anything was wrong. Mark this trigger as executed. pSuperblock->SetExecuted(); - govman.ResetVotedFundingTrigger(); + ResetVotedFundingTrigger(); } } diff --git a/src/governance/classes.h b/src/governance/classes.h index ee73a25a0d..f6ea2db7eb 100644 --- a/src/governance/classes.h +++ b/src/governance/classes.h @@ -33,8 +33,6 @@ public: static bool GetBestSuperblock(CGovernanceManager& govman, const CDeterministicMNList& tip_mn_list, CSuperblock_sptr& pSuperblockRet, int nBlockHeight); public: - static void ExecuteBestSuperblock(CGovernanceManager& govman, const CDeterministicMNList& tip_mn_list, int nBlockHeight); - static bool IsValid(CGovernanceManager& govman, const CChain& active_chain, const CDeterministicMNList& tip_mn_list, const CTransaction& txNew, int nBlockHeight, CAmount blockReward); }; diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index 659f66ce0d..932f5b3726 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -1542,7 +1542,7 @@ void CGovernanceManager::UpdatedBlockTip(const CBlockIndex* pindex, CConnman& co CheckPostponedObjects(peerman); - CSuperblockManager::ExecuteBestSuperblock(*this, Assert(m_dmnman)->GetListAtChainTip(), pindex->nHeight); + ExecuteBestSuperblock(Assert(m_dmnman)->GetListAtChainTip(), pindex->nHeight); } void CGovernanceManager::RequestOrphanObjects(CConnman& connman) diff --git a/src/governance/governance.h b/src/governance/governance.h index 64d0938b0c..25c357c59d 100644 --- a/src/governance/governance.h +++ b/src/governance/governance.h @@ -276,6 +276,7 @@ public: PeerMsgRet ProcessMessage(CNode& peer, CConnman& connman, PeerManager& peerman, std::string_view msg_type, CDataStream& vRecv); +private: void ResetVotedFundingTrigger(); public: @@ -368,6 +369,8 @@ public: std::vector& voutSuperblockRet); private: + void ExecuteBestSuperblock(const CDeterministicMNList& tip_mn_list, int nBlockHeight); + std::optional CreateSuperblockCandidate(int nHeight) const; std::optional CreateGovernanceTrigger(const std::optional& sb_opt, PeerManager& peerman, const CActiveMasternodeManager& mn_activeman);