@@ -311,11 +311,24 @@ 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+ }
317322}
318323
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);
331+
319332void CMasternodePayments::ProcessMessage (CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
320333{
321334 if (fLiteMode ) return ; // disable all Dash specific functionality
@@ -683,14 +696,7 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s
683696 return false ;
684697 }
685698
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- }
699+ int nMinRequiredProtocol = mnpayments.GetMinMasternodePaymentsProto ();
694700
695701 if (mnInfo.nProtocolVersion < nMinRequiredProtocol) {
696702 strError = strprintf (" Masternode protocol is too old: nProtocolVersion=%d, nMinRequiredProtocol=%d" , mnInfo.nProtocolVersion , nMinRequiredProtocol);
@@ -710,13 +716,14 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s
710716 }
711717
712718 if (nRank > MNPAYMENTS_SIGNATURES_TOTAL) {
719+ int vCount = mnpayments.GetFactorEnforcement ();
713720 // It's common to have masternodes mistakenly think they are in the top 10
714721 // We don't want to print all of these messages in normal mode, debug mode should print though
715722 strError = strprintf (" Masternode is not in the top %d (%d)" , MNPAYMENTS_SIGNATURES_TOTAL, nRank);
716723 // 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) {
724+ if (nRank > MNPAYMENTS_SIGNATURES_TOTAL * vCount && nBlockHeight > nValidationHeight) {
718725 LOCK (cs_main);
719- strError = strprintf (" Masternode is not in the top %d (%d)" , MNPAYMENTS_SIGNATURES_TOTAL* 2 , nRank);
726+ strError = strprintf (" Masternode is not in the top %d (%d)" , MNPAYMENTS_SIGNATURES_TOTAL * vCount , nRank);
720727 LogPrintf (" CMasternodePaymentVote::IsValid -- Error: %s\n " , strError);
721728 Misbehaving (pnode->GetId (), 20 );
722729 }
0 commit comments