diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 6fd3b47b3..0a72903da 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1811,8 +1811,6 @@ uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector &Notar if ( staked_era == 0 ) return(0); numSN = numStakedNotaries(staked_pubkeys,staked_era); - // resize coinbase vouts to number of notary nodes +1 for coinbase itself. - txNew.vout.resize(NotarisationNotaries.size()+1); // Check the notarisation is valid, and extract notarised height. uint64_t voutmask; @@ -1833,6 +1831,9 @@ uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector &Notar } } else return(0); + // resize coinbase vouts to number of notary nodes +1 for coinbase itself. + txNew.vout.resize(NotarisationNotaries.size()+1); + // Calcualte the amount to pay. AmountToPay = komodo_notarypayamount(notarizedheight,NotarisationNotaries.size()); diff --git a/src/main.cpp b/src/main.cpp index b904e10e2..b9c66c2ca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -282,6 +282,9 @@ namespace { bool fCurrentlyConnected; //! Accumulated misbehaviour score for this peer. int nMisbehavior; + // count blocks seen. + //int8_t nBlocksinARow; + //int8_t nBlocksinARow2; //! Whether this peer should be disconnected and banned (unless whitelisted). bool fShouldBan; //! String name of this peer (debugging/logging purposes). @@ -5469,6 +5472,20 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo bool checked; uint256 hash; int32_t futureblock=0; auto verifier = libzcash::ProofVerifier::Disabled(); hash = pblock->GetHash(); + /*pfrom->nBlocksinARow += 1; + if ( pfrom->nBlocksinARow >= 6 ) + { + pfrom->nBlocksinARow2 += 1; + if ( pfrom->nBlocksinARow2 > 3 ) + { + pfrom->nBlocksinARow = 0; + pfrom->nBlocksinARow2 = 0; + } + else + { + return(false); + } + }*/ //fprintf(stderr,"ProcessBlock %d\n",(int32_t)chainActive.LastTip()->GetHeight()); { LOCK(cs_main); diff --git a/src/miner.cpp b/src/miner.cpp index 6476a7b48..da5fcd91f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -680,7 +680,12 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 if ( script[0] == OP_RETURN ) { uint64_t totalsats = komodo_notarypay(txNew, NotarisationNotaries, pblock->nTime, nHeight, script, scriptlen); - fprintf(stderr, "Created notary payment coinbase totalsat.%lu\n",totalsats); + if ( totalsats == 0 ) + { + fprintf(stderr, "Could not create notary payment, trying again.\n"); + return(0); + } + fprintf(stderr, "Created notary payment coinbase totalsat.%lu\n",totalsats); } else fprintf(stderr, "vout 2 of notarisation is not OP_RETURN scriptlen.%i\n", scriptlen); }