From ff06e58186ab39d40f7ba840e158433fcf1bc2a0 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Wed, 25 May 2016 10:06:48 -0700 Subject: [PATCH] Added back logic to only allow X votes per masternode winner --- src/masternode-payments.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index db6971a0b4..8f35b50506 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -662,12 +662,28 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError) bool CMasternodePayments::ProcessBlock(int nBlockHeight) { - if(!fMasterNode) return false; + // DETERMINE IF WE SHOULD BE VOTING FOR THE NEXT PAYEE + + if(!fMasterNode) return false; + + 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; + } - CMasternodePaymentWinner newWinner(activeMasternode.vin); // 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()); @@ -694,6 +710,8 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight) } } + // SIGN MESSAGE TO NETWORK WITH OUR MASTERNODE KEYS + std::string errorMessage; CPubKey pubKeyMasternode; CKey keyMasternode;