diff --git a/src/komodo.h b/src/komodo.h index 74c6e2010..5b2872946 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -680,7 +680,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr else { komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata); - printf("[%s] matched.%d VALID (%s) MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth); + if ( matched != 0 ) + printf("[%s] matched.%d VALID (%s) MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth); } if ( MoMoMdata.pairs != 0 ) free(MoMoMdata.pairs); diff --git a/src/miner.cpp b/src/miner.cpp index 445ea2dad..8400e2a17 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -476,23 +476,25 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) UpdateTime(pblock, Params().GetConsensus(), pindexPrev); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus()); } + pblock->nSolution.clear(); + pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 && pblock->nTime < pindexPrev->nTime+60 ) { pblock->nTime = pindexPrev->nTime + 60; - while ( pblock->GetBlockTime() > GetAdjustedTime() + 10 ) - sleep(1); + //while ( pblock->GetBlockTime() > GetAdjustedTime() + 10 ) + // sleep(1); //fprintf(stderr,"block.nTime %u vs prev.%u, gettime.%u vs adjusted.%u\n",(uint32_t)pblock->nTime,(uint32_t)(pindexPrev->nTime + 60),(uint32_t)pblock->GetBlockTime(),(uint32_t)(GetAdjustedTime() + 60)); } - pblock->nSolution.clear(); - pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); - - CValidationState state; - if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) + else { - //static uint32_t counter; - //if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 ) - // fprintf(stderr,"warning: miner testblockvalidity failed\n"); - return(0); + CValidationState state; + if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) + { + //static uint32_t counter; + //if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 ) + // fprintf(stderr,"warning: miner testblockvalidity failed\n"); + return(0); + } } } @@ -788,7 +790,7 @@ void static BitcoinMiner() static uint32_t counter; if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 ) fprintf(stderr,"created illegal block, retry\n"); - sleep(3); + sleep(1); continue; } unique_ptr pblocktemplate(ptr); @@ -953,15 +955,6 @@ void static BitcoinMiner() for (z=31; z>=16; z--) fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); fprintf(stderr," POW\n");*/ - CValidationState state; - if ( !TestBlockValidity(state,B, chainActive.Tip(), true, false)) - { - h = UintToArith256(B.GetHash()); - for (z=31; z>=0; z--) - fprintf(stderr,"%02x",((uint8_t *)&h)[z]); - fprintf(stderr," Invalid block mined, try again\n"); - return(false); - } if ( ASSETCHAINS_STAKED == 0 ) { if ( Mining_start != 0 && time(NULL) < Mining_start+roundrobin_delay ) @@ -993,6 +986,15 @@ void static BitcoinMiner() fprintf(stderr," mined block!\n"); } } + CValidationState state; + if ( !TestBlockValidity(state,B, chainActive.Tip(), true, false)) + { + h = UintToArith256(B.GetHash()); + for (z=31; z>=0; z--) + fprintf(stderr,"%02x",((uint8_t *)&h)[z]); + fprintf(stderr," Invalid block mined, try again\n"); + return(false); + } KOMODO_CHOSEN_ONE = 1; // Found a solution SetThreadPriority(THREAD_PRIORITY_NORMAL);