@@ -143,7 +143,7 @@ bool IsBlockPayeeValid(const CTransactionRef txNew, int nBlockHeight, CAmount bl
143143 // we can only check masternode payments
144144
145145 const Consensus::Params& consensusParams = Params ().GetConsensus ();
146-
146+ // We should leave that here until we start the Superblocksystem. The second stage is the Spork 8 only if Superblock are online - Chris 2020
147147 if (sporkManager.IsSporkActive (SPORK_22_MASTERNODE_PAYMENT_ENFORCEMENT))
148148 {
149149 LogPrintf (" IsBlockPayeeValid SPORK_22 -- ERROR: Invalid masternode payment detected at height %d: %s\n " , nBlockHeight, txNew->ToString ());
@@ -311,9 +311,23 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int nBlockH
311311}
312312
313313int CMasternodePayments::GetMinMasternodePaymentsProto () {
314- return sporkManager.IsSporkActive (SPORK_10_MASTERNODE_PAY_UPDATED_NODES)
315- ? MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2
316- : MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1;
314+ if (DEFAULTMINPROTO < sporkManager.GetSporkValue (SPORK_BTX_18_MIN_PEER_PROTO_VERSION))
315+ {
316+ return sporkManager.GetSporkValue (SPORK_BTX_18_MIN_PEER_PROTO_VERSION);
317+ }
318+ else
319+ {
320+ return DEFAULTMINPROTO;
321+ }
322+ }
323+
324+ int CMasternodePayments::GetFactorEnforcement () {
325+
326+ if (FACTOR_ENFORCEMENT > sporkManager.GetSporkValue (SPORK_22_FACTOR_ENFORCEMENT)|| sporkManager.GetSporkValue (SPORK_22_FACTOR_ENFORCEMENT) > 200 )
327+ {
328+ return FACTOR_ENFORCEMENT;
329+ }
330+ return sporkManager.GetSporkValue (SPORK_22_FACTOR_ENFORCEMENT);
317331}
318332
319333void CMasternodePayments::ProcessMessage (CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
@@ -683,14 +697,7 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s
683697 return false ;
684698 }
685699
686- int nMinRequiredProtocol;
687- if (nBlockHeight >= nValidationHeight) {
688- // new votes must comply SPORK_10_MASTERNODE_PAY_UPDATED_NODES rules
689- nMinRequiredProtocol = mnpayments.GetMinMasternodePaymentsProto ();
690- } else {
691- // allow non-updated masternodes for old blocks
692- nMinRequiredProtocol = MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1;
693- }
700+ int nMinRequiredProtocol = mnpayments.GetMinMasternodePaymentsProto ();
694701
695702 if (mnInfo.nProtocolVersion < nMinRequiredProtocol) {
696703 strError = strprintf (" Masternode protocol is too old: nProtocolVersion=%d, nMinRequiredProtocol=%d" , mnInfo.nProtocolVersion , nMinRequiredProtocol);
@@ -710,13 +717,14 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s
710717 }
711718
712719 if (nRank > MNPAYMENTS_SIGNATURES_TOTAL) {
720+ int vCount = mnpayments.GetFactorEnforcement ();
713721 // It's common to have masternodes mistakenly think they are in the top 10
714722 // We don't want to print all of these messages in normal mode, debug mode should print though
715723 strError = strprintf (" Masternode is not in the top %d (%d)" , MNPAYMENTS_SIGNATURES_TOTAL, nRank);
716724 // Only ban for new mnw which is out of bounds, for old mnw MN list itself might be way too much off
717- if (nRank > MNPAYMENTS_SIGNATURES_TOTAL* 2 && nBlockHeight > nValidationHeight) {
725+ if (nRank > MNPAYMENTS_SIGNATURES_TOTAL * vCount && nBlockHeight > nValidationHeight) {
718726 LOCK (cs_main);
719- strError = strprintf (" Masternode is not in the top %d (%d)" , MNPAYMENTS_SIGNATURES_TOTAL* 2 , nRank);
727+ strError = strprintf (" Masternode is not in the top %d (%d)" , MNPAYMENTS_SIGNATURES_TOTAL * vCount , nRank);
720728 LogPrintf (" CMasternodePaymentVote::IsValid -- Error: %s\n " , strError);
721729 Misbehaving (pnode->GetId (), 20 );
722730 }
0 commit comments