Masternode index rebuild bug fix (#1318)

* Clear old masternode index after vote map rebuild

* Add masternode index size to CMasternodeMan::ToString
This commit is contained in:
Tim Flynn 2017-02-05 04:24:34 -05:00 committed by UdjinM6
parent 1d45023f3e
commit 5520bf6895
2 changed files with 6 additions and 1 deletions

View File

@ -1115,9 +1115,12 @@ int CGovernanceManager::GetMasternodeIndex(const CTxIn& masternodeVin)
LOCK(cs);
bool fIndexRebuilt = false;
int nMNIndex = mnodeman.GetMasternodeIndex(masternodeVin, fIndexRebuilt);
while(fIndexRebuilt) {
if(fIndexRebuilt) {
RebuildVoteMaps();
nMNIndex = mnodeman.GetMasternodeIndex(masternodeVin, fIndexRebuilt);
if(fIndexRebuilt) {
LogPrintf("CGovernanceManager::GetMasternodeIndex -- WARNING: vote map rebuild failed\n");
}
}
return nMNIndex;
}
@ -1127,6 +1130,7 @@ void CGovernanceManager::RebuildVoteMaps()
for(object_m_it it = mapObjects.begin(); it != mapObjects.end(); ++it) {
it->second.RebuildVoteMap();
}
mnodeman.ClearOldMasternodeIndex();
}
void CGovernanceManager::AddCachedTriggers()

View File

@ -1362,6 +1362,7 @@ std::string CMasternodeMan::ToString() const
", peers who asked us for Masternode list: " << (int)mAskedUsForMasternodeList.size() <<
", peers we asked for Masternode list: " << (int)mWeAskedForMasternodeList.size() <<
", entries in Masternode list we asked for: " << (int)mWeAskedForMasternodeListEntry.size() <<
", masternode index size: " << indexMasternodes.GetSize() <<
", nDsqCount: " << (int)nDsqCount;
return info.str();