mn rank tweaks
@@ -509,13 +509,11 @@ bool GetMasternodeRanks()
mn.Check();
if(mn.protocolVersion < MIN_MN_PROTO_VERSION) continue;
- if (!mn.nBlockLastPaid || mn.nBlockLastPaid == 0)
- {
+ int value = -1;
CBlockIndex* pindex = pindexBest;
- int value;
int payments = mn.UpdateLastPaidAmounts(pindex, max(MASTERNODE_FAIR_PAYMENT_MINIMUM, (int)mnCount) * MASTERNODE_FAIR_PAYMENT_ROUNDS, value); // do a search back 1000 blocks when receiving a new masternode to find their last payment, payments = number of payments received, value = amount
- }
- vecMasternodeScores.push_back(make_pair(mn.nBlockLastPaid, &mn));
+
+ vecMasternodeScores.push_back(make_pair(value, &mn));
}
sort(vecMasternodeScores.rbegin(), vecMasternodeScores.rend(), CompareLastPayRate());
@@ -632,7 +630,8 @@ int CMasterNode::SetPayRate(int nHeight)
if (matches > 0) {
payCount = matches;
payValue = amount;
- payRate = ((double)payValue / (scanBack / mnCount))*100;
+ // set the node's current 'reward rate' - pay value divided by rounds (3)
+ payRate = ((double)(payValue / COIN) / MASTERNODE_FAIR_PAYMENT_ROUNDS)*100;
// printf("%d found with %s value %.2f rate\n", matches, FormatMoney(amount).c_str(), payRate);
return matches;
}
@@ -760,8 +759,8 @@ int CMasterNode::UpdateLastPaidAmounts(const CBlockIndex *pindex, int nMaxBlocks
payCount = rewardCount;
payValue = rewardValue;
- // set the node's current 'reward rate'
- payRate = ((double)payValue / (scanBack / mnCount))*100;
+ // set the node's current 'reward rate' - pay value divided by rounds (3)
+ payRate = ((double)(payValue / COIN) / MASTERNODE_FAIR_PAYMENT_ROUNDS)*100;
if (fDebug) printf("CMasternode::UpdateLastPaidAmounts -- MN %s in last %d blocks was paid %d times for %s D, rate:%.2f count:%d val:%s\n", address2.ToString().c_str(), scanBack, rewardCount, FormatMoney(rewardValue).c_str(), payRate, payCount, FormatMoney(payValue).c_str());
