Skip to content

Commit ae229e2

Browse files
committed
Directly use deterministicMNManager in CGovernanceManager::GetCurrentVotes
1 parent 96e0385 commit ae229e2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/governance.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,17 @@ std::vector<CGovernanceVote> CGovernanceManager::GetCurrentVotes(const uint256&
515515
if (it == mapObjects.end()) return vecResult;
516516
const CGovernanceObject& govobj = it->second;
517517

518-
CMasternode mn;
519-
std::map<COutPoint, CMasternode> mapMasternodes;
518+
auto mnList = deterministicMNManager->GetListAtChainTip();
519+
std::map<COutPoint, CDeterministicMNCPtr> mapMasternodes;
520520
if (mnCollateralOutpointFilter.IsNull()) {
521-
mapMasternodes = mnodeman.GetFullMasternodeMap();
522-
} else if (mnodeman.Get(mnCollateralOutpointFilter, mn)) {
523-
mapMasternodes[mnCollateralOutpointFilter] = mn;
521+
mnList.ForEachMN(true, [&](const CDeterministicMNCPtr& dmn) {
522+
mapMasternodes.emplace(dmn->collateralOutpoint, dmn);
523+
});
524+
} else {
525+
auto dmn = mnList.GetValidMNByCollateral(mnCollateralOutpointFilter);
526+
if (dmn) {
527+
mapMasternodes.emplace(dmn->collateralOutpoint, dmn);
528+
}
524529
}
525530

526531
// Loop thru each MN collateral outpoint and get the votes for the `nParentHash` governance object

0 commit comments

Comments
 (0)