This commit is contained in:
jl777
2019-08-02 05:01:38 -11:00
parent 40f18eeca5
commit 3cf10af4ee
3 changed files with 8 additions and 7 deletions

View File

@@ -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());