@@ -2546,7 +2546,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
25462546
25472547 CScript payee;
25482548 CTxIn vin;
2549- if (!masternodePayments.GetBlockPayee (pindexBest->nHeight +1 , payee, vin) || payee == CScript ()){
2549+ if (!masternodePayments.GetWinningMasternode (pindexBest->nHeight +1 , payee, vin) || payee == CScript ()){
25502550 foundPayee = true ; // doesn't require a specific payee
25512551 foundPaymentAmount = true ;
25522552 foundPaymentAndPayee = true ;
@@ -2689,7 +2689,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
26892689 if (isProofOfStake) {
26902690 // Check for PoS masternode payment
26912691 if (i == nProofOfIndexMasternode) {
2692- if (mnodeman.IsPayeeAValidMasternode (rawPayee)) {
2692+ if (mnodeman.IsPayeeAValidMasternode (rawPayee) && fMNselect (pindexBest-> nHeight ) ) {
26932693 LogPrintf (" CheckBlock() : PoS Recipient masternode address validity succesfully verified\n " );
26942694 } else if (addressOut.ToString () == strVfyDevopsAddress) {
26952695 LogPrintf (" CheckBlock() : PoS Recipient masternode address validity succesfully verified\n " );
@@ -2748,7 +2748,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
27482748 else if (!isProofOfStake) {
27492749 // Check for PoW masternode payment
27502750 if (i == nProofOfIndexMasternode) {
2751- if (mnodeman.IsPayeeAValidMasternode (rawPayee)) {
2751+ if (mnodeman.IsPayeeAValidMasternode (rawPayee) && fMNselect (pindexBest-> nHeight ) ) {
27522752 LogPrintf (" CheckBlock() : PoW Recipient masternode address validity succesfully verified\n " );
27532753 } else if (addressOut.ToString () == strVfyDevopsAddress) {
27542754 LogPrintf (" CheckBlock() : PoW Recipient masternode address validity succesfully verified\n " );
@@ -3123,15 +3123,18 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
31233123 mapOrphanBlocksByPrev.erase (hashPrev);
31243124 }
31253125
3126- if (!IsInitialBlockDownload ()){
3126+ // Try to get frist masternode in our list
3127+ CMasternode* winningNode = mnodeman.GetCurrentMasterNode (1 );
3128+ // If initial sync or we can't find a masternode in our list
3129+ if (!IsInitialBlockDownload () || winningNode){
31273130
31283131 CScript payee;
31293132 CTxIn vin;
31303133
31313134 // If we're in LiteMode disable mnengine features without disabling masternodes
31323135 if (!fLiteMode && !fImporting && !fReindex && pindexBest->nHeight > Checkpoints::GetTotalBlocksEstimate ()){
31333136
3134- if (masternodePayments.GetBlockPayee (pindexBest->nHeight , payee, vin)){
3137+ if (masternodePayments.GetWinningMasternode (pindexBest->nHeight , payee, vin)){
31353138 // UPDATE MASTERNODE LAST PAID TIME
31363139 CMasternode* pmn = mnodeman.Find (vin);
31373140 if (pmn != NULL ) {
@@ -3143,11 +3146,10 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
31433146
31443147 mnEnginePool.CheckTimeout ();
31453148 mnEnginePool.NewBlock ();
3146- masternodePayments.ProcessBlock (GetHeight ()+10 );
31473149
31483150 } else if (fLiteMode && !fImporting && !fReindex && pindexBest->nHeight > Checkpoints::GetTotalBlocksEstimate ())
31493151 {
3150- if (masternodePayments.GetBlockPayee (pindexBest->nHeight , payee, vin)){
3152+ if (masternodePayments.GetWinningMasternode (pindexBest->nHeight , payee, vin)){
31513153 // UPDATE MASTERNODE LAST PAID TIME
31523154 CMasternode* pmn = mnodeman.Find (vin);
31533155 if (pmn != NULL ) {
@@ -3156,10 +3158,7 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
31563158
31573159 LogPrintf (" ProcessBlock() : Update Masternode Last Paid Time - %d\n " , pindexBest->nHeight );
31583160 }
3159-
3160- masternodePayments.ProcessBlock (GetHeight ()+10 );
31613161 }
3162-
31633162 }
31643163
31653164 LogPrintf (" ProcessBlock: ACCEPTED\n " );
@@ -4416,10 +4415,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
44164415 if (fSecMsgEnabled ) {
44174416 SecureMsgReceiveData (pfrom, strCommand, vRecv);
44184417 }
4419- mnodeman.ProcessMessage (pfrom, strCommand, vRecv);
4420- ProcessMessageMasternodePayments (pfrom, strCommand, vRecv);
4421- ProcessMessageInstantX (pfrom, strCommand, vRecv);
4422- ProcessSpork (pfrom, strCommand, vRecv);
4418+ if (pfrom->nVersion >= MIN_MASTERNODE_BSC_RELAY) {
4419+ mnodeman.ProcessMessage (pfrom, strCommand, vRecv);
4420+ ProcessMessageMasternodePayments (pfrom, strCommand, vRecv);
4421+ ProcessMessageInstantX (pfrom, strCommand, vRecv);
4422+ ProcessSpork (pfrom, strCommand, vRecv);
4423+ }
44234424 // Ignore unknown commands for extensibility
44244425 }
44254426
0 commit comments