Merge remote-tracking branch 'upstream/v0.11.2.x' into v0.11.2.x

This commit is contained in:
snogcel 2015-03-19 22:00:09 -06:00
commit 148435eb15
3 changed files with 8 additions and 5 deletions

View File

@ -406,9 +406,8 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
} }
// pay to the oldest MN that still had no payment but its input is old enough and it was active long enough // pay to the oldest MN that still had no payment but its input is old enough and it was active long enough
CMasternode *pmn = mnodeman.FindOldestNotInVec(vecLastPayments); CMasternode *pmn = mnodeman.FindOldestNotInVec(vecLastPayments, nMinimumAge, nMinimumAge * 2.5 * 60);
if(pmn != NULL && if(pmn != NULL)
(RegTest() || (!RegTest() && pmn->GetMasternodeInputAge() > nMinimumAge && pmn->lastTimeSeen - pmn->sigTime > nMinimumAge * 2.5 * 60)))
{ {
newWinner.score = 0; newWinner.score = 0;
newWinner.nBlockHeight = nBlockHeight; newWinner.nBlockHeight = nBlockHeight;

View File

@ -312,7 +312,7 @@ CMasternode *CMasternodeMan::Find(const CTxIn &vin)
return NULL; return NULL;
} }
CMasternode* CMasternodeMan::FindOldestNotInVec(const std::vector<CTxIn> &vVins) CMasternode* CMasternodeMan::FindOldestNotInVec(const std::vector<CTxIn> &vVins, int nMinimumAge, int nMinimumActiveSeconds)
{ {
LOCK(cs); LOCK(cs);
@ -323,6 +323,10 @@ CMasternode* CMasternodeMan::FindOldestNotInVec(const std::vector<CTxIn> &vVins)
mn.Check(); mn.Check();
if(!mn.IsEnabled()) continue; if(!mn.IsEnabled()) continue;
if(!RegTest()){
if(mn.GetMasternodeInputAge() < nMinimumAge || mn.lastTimeSeen - mn.sigTime < nMinimumActiveSeconds) continue;
}
bool found = false; bool found = false;
BOOST_FOREACH(const CTxIn& vin, vVins) BOOST_FOREACH(const CTxIn& vin, vVins)
if(mn.vin == vin) if(mn.vin == vin)

View File

@ -108,7 +108,7 @@ public:
CMasternode* Find(const CTxIn& vin); CMasternode* Find(const CTxIn& vin);
/// Find an entry thta do not match every entry provided vector /// Find an entry thta do not match every entry provided vector
CMasternode* FindOldestNotInVec(const std::vector<CTxIn> &vVins); CMasternode* FindOldestNotInVec(const std::vector<CTxIn> &vVins, int nMinimumAge, int nMinimumActiveSeconds);
/// Find a random entry /// Find a random entry
CMasternode* FindRandom(); CMasternode* FindRandom();