Merge pull request #1143 from tgflynn/v0.12.1.x-mnodeman-cleanup

CMasternodeMan cleanup
This commit is contained in:
UdjinM6 2016-11-16 12:28:57 +04:00 committed by GitHub
commit a7dae03bfb
2 changed files with 5 additions and 22 deletions

View File

@ -167,7 +167,7 @@ void CMasternodeMan::Check()
}
}
void CMasternodeMan::CheckAndRemove(bool fForceExpiredRemoval)
void CMasternodeMan::CheckAndRemove()
{
LogPrintf("CMasternodeMan::CheckAndRemove\n");
@ -182,9 +182,7 @@ void CMasternodeMan::CheckAndRemove(bool fForceExpiredRemoval)
bool fRemove = // If it's marked to be removed from the list by CMasternode::Check for whatever reason ...
(*it).nActiveState == CMasternode::MASTERNODE_REMOVE ||
// or collateral was spent ...
(*it).nActiveState == CMasternode::MASTERNODE_OUTPOINT_SPENT ||
// or we were asked to remove exired entries ...
(fForceExpiredRemoval && (*it).nActiveState == CMasternode::MASTERNODE_EXPIRED);
(*it).nActiveState == CMasternode::MASTERNODE_OUTPOINT_SPENT;
if (fRemove) {
LogPrint("masternode", "CMasternodeMan::CheckAndRemove -- Removing Masternode: %s addr=%s %i now\n", (*it).GetStatus(), (*it).addr.ToString(), size() - 1);
@ -297,6 +295,8 @@ void CMasternodeMan::Clear()
mapSeenMasternodePing.clear();
nDsqCount = 0;
nLastWatchdogVoteTime = 0;
indexMasternodes.Clear();
indexMasternodesOld.Clear();
}
int CMasternodeMan::CountMasternodes(int nProtocolVersion)
@ -1235,21 +1235,6 @@ void CMasternodeMan::ProcessVerifyBroadcast(CNode* pnode, const CMasternodeVerif
}
}
void CMasternodeMan::Remove(CTxIn vin)
{
LOCK(cs);
std::vector<CMasternode>::iterator it = vMasternodes.begin();
while(it != vMasternodes.end()) {
if((*it).vin == vin) {
LogPrint("masternode", "CMasternodeMan::Remove -- Removing Masternode: %s addr=%s, %i now\n", vin.prevout.ToStringShort(), (*it).addr.ToString(), size() - 1);
vMasternodes.erase(it);
break;
}
++it;
}
}
std::string CMasternodeMan::ToString() const
{
std::ostringstream info;

View File

@ -194,7 +194,7 @@ public:
void Check();
/// Check all Masternodes and remove inactive
void CheckAndRemove(bool fForceExpiredRemoval = false);
void CheckAndRemove();
/// Clear Masternode vector
void Clear();
@ -297,8 +297,6 @@ public:
std::string ToString() const;
void Remove(CTxIn vin);
int GetEstimatedMasternodes(int nBlock);
/// Update masternode list and maps using provided CMasternodeBroadcast