Merge pull request #572 from UdjinM6/v0.12.1.x_fix_mem

V0.12.1.x more mem fixes:
This commit is contained in:
evan82 2015-08-25 09:08:28 -07:00
commit 518499a819
3 changed files with 6 additions and 2 deletions

View File

@ -593,7 +593,7 @@ bool CMasternodePayments::IsTransactionValid(const CTransaction& txNew, int nBlo
void CMasternodePayments::CleanPaymentList()
{
LOCK(cs_mapMasternodePayeeVotes);
LOCK2(cs_mapMasternodePayeeVotes, cs_mapMasternodeBlocks);
if(chainActive.Tip() == NULL) return;
@ -608,6 +608,7 @@ void CMasternodePayments::CleanPaymentList()
LogPrint("mnpayments", "CMasternodePayments::CleanPaymentList - Removing old Masternode payment - block %d\n", winner.nBlockHeight);
masternodeSync.mapSeenSyncMNW.erase((*it).first);
mapMasternodePayeeVotes.erase(it++);
mapMasternodeBlocks.erase(winner.nBlockHeight);
} else {
++it;
}

View File

@ -444,6 +444,7 @@ bool CMasternodeBroadcast::CheckInputsAndAdd(int& nDoS)
if(!lockMain) {
// not mnb fault, let it to be checked again later
mnodeman.mapSeenMasternodeBroadcast.erase(GetHash());
masternodeSync.mapSeenSyncMNB.erase(GetHash());
return false;
}
@ -460,6 +461,7 @@ bool CMasternodeBroadcast::CheckInputsAndAdd(int& nDoS)
LogPrintf("mnb - Input must have at least %d confirmations\n", MASTERNODE_MIN_CONFIRMATIONS);
// maybe we miss few blocks, let this mnb to be checked again later
mnodeman.mapSeenMasternodeBroadcast.erase(GetHash());
masternodeSync.mapSeenSyncMNB.erase(GetHash());
return false;
}

View File

@ -327,8 +327,9 @@ void CMasternodeMan::CheckAndRemove(bool forceExpiredRemoval)
// remove expired mapSeenMasternodeBroadcast
map<uint256, CMasternodeBroadcast>::iterator it3 = mapSeenMasternodeBroadcast.begin();
while(it3 != mapSeenMasternodeBroadcast.end()){
if((*it3).second.sigTime < GetTime()-(MASTERNODE_MIN_MNP_SECONDS*2)){
if((*it3).second.lastPing.sigTime < GetTime()-(MASTERNODE_REMOVAL_SECONDS*2)){
mapSeenMasternodeBroadcast.erase(it3++);
masternodeSync.mapSeenSyncMNB.erase((*it3).second.GetHash());
} else {
++it3;
}