[PrivateSend] vecMasternodesUsed: remove several nodes at once (#1060)

This commit is contained in:
crowning- 2016-10-07 18:15:03 +02:00 committed by UdjinM6
parent 1eb399cf34
commit 81c3ccbdf8

View File

@ -1504,12 +1504,14 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
}
}
//if we've used 90% of the Masternode list then drop all the oldest first
int nThreshold = (int)(mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION) * 0.9);
LogPrint("privatesend", "Checking vecMasternodesUsed: size: %d, threshold: %d\n", (int)vecMasternodesUsed.size(), nThreshold);
while((int)vecMasternodesUsed.size() > nThreshold) {
vecMasternodesUsed.erase(vecMasternodesUsed.begin());
LogPrint("privatesend", " vecMasternodesUsed: size: %d, threshold: %d\n", (int)vecMasternodesUsed.size(), nThreshold);
// If we've used 90% of the Masternode list then drop the oldest first ~30%
int nThreshold_high = (int)(mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION) * 0.9);
int nThreshold_low = nThreshold_high * 0.7;
LogPrint("privatesend", "Checking vecMasternodesUsed: size: %d, threshold: %d\n", (int)vecMasternodesUsed.size(), nThreshold_high);
if((int)vecMasternodesUsed.size() > nThreshold_high) {
vecMasternodesUsed.erase(vecMasternodesUsed.begin(), vecMasternodesUsed.begin() + vecMasternodesUsed.size() - nThreshold_low);
LogPrint("privatesend", " vecMasternodesUsed: new size: %d, threshold: %d\n", (int)vecMasternodesUsed.size(), nThreshold_high);
}
bool fUseQueue = insecure_rand()%100 > 33;