Added back logic to only allow X votes per masternode winner

This commit is contained in:
Evan Duffield 2016-05-25 10:06:48 -07:00
parent 8cbe280dd1
commit ff06e58186

View File

@ -662,12 +662,28 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
bool CMasternodePayments::ProcessBlock(int nBlockHeight) bool CMasternodePayments::ProcessBlock(int nBlockHeight)
{ {
// DETERMINE IF WE SHOULD BE VOTING FOR THE NEXT PAYEE
if(!fMasterNode) return false; if(!fMasterNode) return false;
CMasternodePaymentWinner newWinner(activeMasternode.vin); int n = mnodeman.GetMasternodeRank(activeMasternode.vin, nBlockHeight-100, MIN_MNW_PEER_PROTO_VERSION);
if(n == -1)
{
LogPrint("mnpayments", "CMasternodePayments::ProcessBlock - Unknown Masternode\n");
return false;
}
if(n > MNPAYMENTS_SIGNATURES_TOTAL)
{
LogPrint("mnpayments", "CMasternodePayments::ProcessBlock - Masternode not in the top %d (%d)\n", MNPAYMENTS_SIGNATURES_TOTAL, n);
return false;
}
// LOCATE THE NEXT MASTERNODE WHICH SHOULD BE PAID // LOCATE THE NEXT MASTERNODE WHICH SHOULD BE PAID
CMasternodePaymentWinner newWinner(activeMasternode.vin);
{ {
LogPrintf("CMasternodePayments::ProcessBlock() Start nHeight %d - vin %s. \n", nBlockHeight, activeMasternode.vin.ToString()); LogPrintf("CMasternodePayments::ProcessBlock() Start nHeight %d - vin %s. \n", nBlockHeight, activeMasternode.vin.ToString());
@ -694,6 +710,8 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
} }
} }
// SIGN MESSAGE TO NETWORK WITH OUR MASTERNODE KEYS
std::string errorMessage; std::string errorMessage;
CPubKey pubKeyMasternode; CPubKey pubKeyMasternode;
CKey keyMasternode; CKey keyMasternode;