Directly use deterministicMNManager in CGovernanceManager::GetCurrentVotes

This commit is contained in:
Alexander Block 2018-12-17 13:34:52 +01:00
parent 96e0385db8
commit ae229e2833

View File

@ -515,12 +515,17 @@ std::vector<CGovernanceVote> CGovernanceManager::GetCurrentVotes(const uint256&
if (it == mapObjects.end()) return vecResult;
const CGovernanceObject& govobj = it->second;
CMasternode mn;
std::map<COutPoint, CMasternode> mapMasternodes;
auto mnList = deterministicMNManager->GetListAtChainTip();
std::map<COutPoint, CDeterministicMNCPtr> 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