mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: move ExecuteBestSuperblock to CGovernanceManager
This commit is contained in:
parent
107d5b4941
commit
de8969f463
@ -365,16 +365,16 @@ bool CSuperblockManager::IsValid(CGovernanceManager& govman, const CChain& activ
|
|||||||
return false;
|
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;
|
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,
|
// 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.
|
// tip wouldn't be updated if anything was wrong. Mark this trigger as executed.
|
||||||
pSuperblock->SetExecuted();
|
pSuperblock->SetExecuted();
|
||||||
govman.ResetVotedFundingTrigger();
|
ResetVotedFundingTrigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,6 @@ public:
|
|||||||
static bool GetBestSuperblock(CGovernanceManager& govman, const CDeterministicMNList& tip_mn_list, CSuperblock_sptr& pSuperblockRet, int nBlockHeight);
|
static bool GetBestSuperblock(CGovernanceManager& govman, const CDeterministicMNList& tip_mn_list, CSuperblock_sptr& pSuperblockRet, int nBlockHeight);
|
||||||
|
|
||||||
public:
|
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);
|
static bool IsValid(CGovernanceManager& govman, const CChain& active_chain, const CDeterministicMNList& tip_mn_list, const CTransaction& txNew, int nBlockHeight, CAmount blockReward);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1542,7 +1542,7 @@ void CGovernanceManager::UpdatedBlockTip(const CBlockIndex* pindex, CConnman& co
|
|||||||
|
|
||||||
CheckPostponedObjects(peerman);
|
CheckPostponedObjects(peerman);
|
||||||
|
|
||||||
CSuperblockManager::ExecuteBestSuperblock(*this, Assert(m_dmnman)->GetListAtChainTip(), pindex->nHeight);
|
ExecuteBestSuperblock(Assert(m_dmnman)->GetListAtChainTip(), pindex->nHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGovernanceManager::RequestOrphanObjects(CConnman& connman)
|
void CGovernanceManager::RequestOrphanObjects(CConnman& connman)
|
||||||
|
@ -276,6 +276,7 @@ public:
|
|||||||
|
|
||||||
PeerMsgRet ProcessMessage(CNode& peer, CConnman& connman, PeerManager& peerman, std::string_view msg_type, CDataStream& vRecv);
|
PeerMsgRet ProcessMessage(CNode& peer, CConnman& connman, PeerManager& peerman, std::string_view msg_type, CDataStream& vRecv);
|
||||||
|
|
||||||
|
private:
|
||||||
void ResetVotedFundingTrigger();
|
void ResetVotedFundingTrigger();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -368,6 +369,8 @@ public:
|
|||||||
std::vector<CTxOut>& voutSuperblockRet);
|
std::vector<CTxOut>& voutSuperblockRet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void ExecuteBestSuperblock(const CDeterministicMNList& tip_mn_list, int nBlockHeight);
|
||||||
|
|
||||||
std::optional<const CSuperblock> CreateSuperblockCandidate(int nHeight) const;
|
std::optional<const CSuperblock> CreateSuperblockCandidate(int nHeight) const;
|
||||||
std::optional<const CGovernanceObject> CreateGovernanceTrigger(const std::optional<const CSuperblock>& sb_opt, PeerManager& peerman,
|
std::optional<const CGovernanceObject> CreateGovernanceTrigger(const std::optional<const CSuperblock>& sb_opt, PeerManager& peerman,
|
||||||
const CActiveMasternodeManager& mn_activeman);
|
const CActiveMasternodeManager& mn_activeman);
|
||||||
|
Loading…
Reference in New Issue
Block a user