diff --git a/src/governance.cpp b/src/governance.cpp index 496427a409..61be558a24 100644 --- a/src/governance.cpp +++ b/src/governance.cpp @@ -515,12 +515,17 @@ std::vector CGovernanceManager::GetCurrentVotes(const uint256& if (it == mapObjects.end()) return vecResult; const CGovernanceObject& govobj = it->second; - CMasternode mn; - std::map mapMasternodes; + auto mnList = deterministicMNManager->GetListAtChainTip(); + std::map mapMasternodes; if (mnCollateralOutpointFilter.IsNull()) { - mapMasternodes = mnodeman.GetFullMasternodeMap(); - } else if (mnodeman.Get(mnCollateralOutpointFilter, mn)) { - mapMasternodes[mnCollateralOutpointFilter] = mn; + mnList.ForEachMN(true, [&](const CDeterministicMNCPtr& dmn) { + mapMasternodes.emplace(dmn->collateralOutpoint, dmn); + }); + } else { + auto dmn = mnList.GetValidMNByCollateral(mnCollateralOutpointFilter); + if (dmn) { + mapMasternodes.emplace(dmn->collateralOutpoint, dmn); + } } // Loop thru each MN collateral outpoint and get the votes for the `nParentHash` governance object