check and remove expired masternodes on client start / more info on load/flush

This commit is contained in:
UdjinM6 2015-03-01 02:56:52 +03:00
parent 2d3426755c
commit 4af7c7411a
3 changed files with 20 additions and 3 deletions

View File

@ -1160,10 +1160,12 @@ bool AppInit2(boost::thread_group& threadGroup)
CMasternodeDB mndb;
if (!mndb.Read(mnodeman))
LogPrintf("Invalid or missing masternodes.dat; recreating\n");
else
mnodeman.CheckAndRemove(); // clean out expired
}
LogPrintf("Loaded %i masternodes from masternodes.dat %dms\n",
mnodeman.size(), GetTimeMillis() - nStart);
LogPrintf("Loaded info from masternodes.dat %dms\n", GetTimeMillis() - nStart);
LogPrintf(" %s\n", mnodeman.ToString());
fMasterNode = GetBoolArg("-masternode", false);

View File

@ -123,7 +123,8 @@ void DumpMasternodes()
CMasternodeDB mndb;
mndb.Write(mnodeman);
LogPrintf("Flushed %d masternodes to masternodes.dat %dms\n", mnodeman.size(), GetTimeMillis() - nStart);
LogPrintf("Flushed info to masternodes.dat %dms\n", GetTimeMillis() - nStart);
LogPrintf(" %s\n", mnodeman.ToString());
}
CMasternodeMan::CMasternodeMan() {}
@ -628,3 +629,15 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
}
}
std::string CMasternodeMan::ToString()
{
std::ostringstream info;
info << "masternodes: " << (int)vMasternodes.size() <<
", 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();
return info.str();
}

View File

@ -113,6 +113,8 @@ public:
// Return the number of (unique) masternodes
int size() { return vMasternodes.size(); }
std::string ToString();
};
#endif