diff --git a/src/main.cpp b/src/main.cpp index 9cffe8a76..f7dbebd58 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5296,7 +5296,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta } // Check timestamp against prev - if ( ASSETCHAINS_ADAPTIVEPOW == 0 || nHeight < 30 ) + if ( ASSETCHAINS_ADAPTIVEPOW <= 0 || nHeight < 30 ) { if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast() ) { diff --git a/src/miner.cpp b/src/miner.cpp index 35512a7e2..54af1d021 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -123,12 +123,13 @@ public: void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) { - if ( ASSETCHAINS_ADAPTIVEPOW == 0 ) + if ( ASSETCHAINS_ADAPTIVEPOW <= 0 ) pblock->nTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); else pblock->nTime = std::max((int64_t)(pindexPrev->nTime+1), GetAdjustedTime()); // Updating time can change work required on testnet: - if (consensusParams.nPowAllowMinDifficultyBlocksAfterHeight != boost::none) { + if (ASSETCHAINS_ADAPTIVEPOW > 0 || consensusParams.nPowAllowMinDifficultyBlocksAfterHeight != boost::none) + { pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams); } } @@ -569,7 +570,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; - if ( ASSETCHAINS_ADAPTIVEPOW == 0 ) + if ( ASSETCHAINS_ADAPTIVEPOW <= 0 ) blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); else blocktime = 1 + std::max((int64_t)(pindexPrev->nTime+1), GetAdjustedTime()); //pblock->nTime = blocktime + 1; @@ -644,7 +645,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees; //fprintf(stderr,"mine ht.%d with %.8f\n",nHeight,(double)txNew.vout[0].nValue/COIN); txNew.nExpiryHeight = 0; - if ( ASSETCHAINS_ADAPTIVEPOW == 0 ) + if ( ASSETCHAINS_ADAPTIVEPOW <= 0 ) txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); else txNew.nLockTime = std::max((int64_t)(pindexPrev->nTime+1), GetAdjustedTime()); diff --git a/src/pow.cpp b/src/pow.cpp index fc03bf766..4a918d047 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -89,7 +89,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead { blocktime = pindexFirst->nTime; diff = (pblock->nTime - blocktime); - fprintf(stderr,"%d ",diff); + //fprintf(stderr,"%d ",diff); if ( i < 12 ) { if ( i == 3 ) @@ -104,7 +104,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead } pindexFirst = pindexFirst->pprev; } - fprintf(stderr,"diffs %d\n",(int32_t) pindexLast->GetHeight()); + //fprintf(stderr,"diffs %d\n",(int32_t) pindexLast->GetHeight()); // Check we have enough blocks if (pindexFirst == NULL) return nProofOfWorkLimit;