Fetch upstream

This commit is contained in:
crowning2 2015-02-27 22:15:16 +01:00
commit d1a6133104
2 changed files with 11 additions and 9 deletions

View File

@ -123,8 +123,7 @@ void DumpMasternodes()
CMasternodeDB mndb; CMasternodeDB mndb;
mndb.Write(mnodeman); mndb.Write(mnodeman);
LogPrint("masternode", "Flushed %d masternodes to masternodes.dat %dms\n", LogPrintf("Flushed %d masternodes to masternodes.dat %dms\n", mnodeman.size(), GetTimeMillis() - nStart);
mnodeman.size(), GetTimeMillis() - nStart);
} }
CMasternodeMan::CMasternodeMan() {} CMasternodeMan::CMasternodeMan() {}
@ -140,6 +139,7 @@ bool CMasternodeMan::Add(CMasternode &mn)
if (pmn == NULL) if (pmn == NULL)
{ {
LogPrintf("CMasternodeMan: Adding new masternode %s\n", mn.addr.ToString().c_str());
vMasternodes.push_back(mn); vMasternodes.push_back(mn);
return true; return true;
} }
@ -165,8 +165,8 @@ void CMasternodeMan::CheckAndRemove()
vector<CMasternode>::iterator it = vMasternodes.begin(); vector<CMasternode>::iterator it = vMasternodes.begin();
while(it != vMasternodes.end()){ while(it != vMasternodes.end()){
if((*it).activeState == 4 || (*it).activeState == 3){ if((*it).activeState == 4 || (*it).activeState == 3){
LogPrintf("Removing inactive masternode %s\n", (*it).addr.ToString().c_str()); LogPrintf("CMasternodeMan: Removing inactive masternode %s\n", (*it).addr.ToString().c_str());
vMasternodes.erase(it++); it = vMasternodes.erase(it);
} else { } else {
++it; ++it;
} }
@ -178,7 +178,7 @@ void CMasternodeMan::CheckAndRemove()
if((*it1).second < GetTime()) { if((*it1).second < GetTime()) {
mAskedUsForMasternodeList.erase(it1++); mAskedUsForMasternodeList.erase(it1++);
} else { } else {
it1++; ++it1;
} }
} }
@ -188,7 +188,7 @@ void CMasternodeMan::CheckAndRemove()
if((*it1).second < GetTime()){ if((*it1).second < GetTime()){
mWeAskedForMasternodeList.erase(it1++); mWeAskedForMasternodeList.erase(it1++);
} else { } else {
it1++; ++it1;
} }
} }
@ -198,7 +198,7 @@ void CMasternodeMan::CheckAndRemove()
if((*it2).second < GetTime()){ if((*it2).second < GetTime()){
mWeAskedForMasternodeListEntry.erase(it2++); mWeAskedForMasternodeListEntry.erase(it2++);
} else { } else {
it2++; ++it2;
} }
} }
@ -231,6 +231,8 @@ int CMasternodeMan::CountMasternodesAboveProtocol(int protocolVersion)
void CMasternodeMan::DsegUpdate(CNode* pnode) void CMasternodeMan::DsegUpdate(CNode* pnode)
{ {
LOCK(cs);
std::map<CNetAddr, int64_t>::iterator it = mWeAskedForMasternodeList.find(pnode->addr); std::map<CNetAddr, int64_t>::iterator it = mWeAskedForMasternodeList.find(pnode->addr);
if (it != mWeAskedForMasternodeList.end()) if (it != mWeAskedForMasternodeList.end())
{ {
@ -574,7 +576,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
LogPrintf("dseep - Asking source node for missing entry %s\n", vin.ToString().c_str()); LogPrintf("dseep - Asking source node for missing entry %s\n", vin.ToString().c_str());
pfrom->PushMessage("dseg", vin); pfrom->PushMessage("dseg", vin);
int64_t askAgain = GetTime()+(60*60*24); int64_t askAgain = GetTime() + MASTERNODE_MIN_DSEEP_SECONDS;
mWeAskedForMasternodeListEntry[vin.prevout] = askAgain; mWeAskedForMasternodeListEntry[vin.prevout] = askAgain;
} else if (strCommand == "dseg") { //Get masternode list or specific entry } else if (strCommand == "dseg") { //Get masternode list or specific entry

View File

@ -84,7 +84,7 @@ public:
void CheckAndRemove(); void CheckAndRemove();
// Clear masternode vector // Clear masternode vector
void Clear() { vMasternodes.clear(); } void Clear() { LOCK(cs); vMasternodes.clear(); }
int CountEnabled(); int CountEnabled();