@@ -49,7 +49,7 @@ static CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 20);
4949unsigned int nStakeMinAge = 10000 * 10000 ; // minimum age disabled
5050unsigned int nStakeMaxAge = 10000 * 10000 ; // stake max age disabled
5151unsigned int nStakeTargetSpacing = 30 ; // 30 seconds POS block spacing
52- unsigned int nProofOfWorkTargetSpacing = 15 ; // 30 seconds PoW block spacing
52+ // unsigned int nProofOfWorkTargetSpacing = 15; // 30 seconds PoW block spacing
5353
5454int64 nChainStartTime = 1507311620 ;
5555int nCoinbaseMaturity = 240 ;
@@ -1088,7 +1088,7 @@ void avgRecentTimestamps(const CBlockIndex* pindexLast, int64_t *avgOf5, int64_t
10881088 }
10891089 else
10901090 { // genesis block or previous
1091- blocktime -= nProofOfWorkTargetSpacing ;
1091+ blocktime -= GetTargetSpacing (pindexLast-> nHeight ) ;
10921092 }
10931093 // for each block, add interval.
10941094 if (blockoffset < 5 ) *avgOf5 += (oldblocktime - blocktime);
@@ -1116,8 +1116,8 @@ unsigned int GetNextTargetRequired_V2(const CBlockIndex* pindexLast, bool fProof
11161116 int64_t now;
11171117 int64_t BlockHeightTime;
11181118
1119- int64_t nFastInterval = (nProofOfWorkTargetSpacing * 9 ) / 10 ; // seconds per block desired when far behind schedule
1120- int64_t nSlowInterval = (nProofOfWorkTargetSpacing * 11 ) / 10 ; // seconds per block desired when far ahead of schedule
1119+ int64_t nFastInterval = (GetTargetSpacing (pindexLast-> nHeight ) * 9 ) / 10 ; // seconds per block desired when far behind schedule
1120+ int64_t nSlowInterval = (GetTargetSpacing (pindexLast-> nHeight ) * 11 ) / 10 ; // seconds per block desired when far ahead of schedule
11211121 int64_t nIntervalDesired;
11221122
11231123
@@ -1136,15 +1136,15 @@ unsigned int GetNextTargetRequired_V2(const CBlockIndex* pindexLast, bool fProof
11361136
11371137 now = pindexLast->GetBlockTime ();
11381138
1139- BlockHeightTime = pindexGenesisBlock->nTime + pindexLast->nHeight * nProofOfWorkTargetSpacing ;
1139+ BlockHeightTime = pindexGenesisBlock->nTime + pindexLast->nHeight * GetTargetSpacing (pindexLast-> nHeight ) ;
11401140
11411141 if (now < BlockHeightTime + nTargetTimespan && now > BlockHeightTime )
11421142 // ahead of schedule by less than one interval.
1143- nIntervalDesired = ((nTargetTimespan - (now - BlockHeightTime)) * nProofOfWorkTargetSpacing +
1144- (now - BlockHeightTime) * nFastInterval) / nProofOfWorkTargetSpacing ;
1143+ nIntervalDesired = ((nTargetTimespan - (now - BlockHeightTime)) * GetTargetSpacing (pindexLast-> nHeight ) +
1144+ (now - BlockHeightTime) * nFastInterval) / GetTargetSpacing (pindexLast-> nHeight ) ;
11451145 else if (now + nTargetTimespan > BlockHeightTime && now < BlockHeightTime)
11461146 // behind schedule by less than one interval.
1147- nIntervalDesired = ((nTargetTimespan - (BlockHeightTime - now)) * nProofOfWorkTargetSpacing +
1147+ nIntervalDesired = ((nTargetTimespan - (BlockHeightTime - now)) * GetTargetSpacing (pindexLast-> nHeight ) +
11481148 (BlockHeightTime - now) * nSlowInterval) / nTargetTimespan;
11491149
11501150 // ahead by more than one interval;
@@ -1212,7 +1212,7 @@ unsigned int GetNextTargetRequired_V2(const CBlockIndex* pindexLast, bool fProof
12121212
12131213 printf (" difficulty: ctual time %" PRId64 " , Scheduled time for this block height = %" PRId64 " \n " , now, BlockHeightTime );
12141214 printf (" difficulty: Nominal block interval = %u, regulating on interval %" PRId64 " to get back to schedule.\n " ,
1215- nProofOfWorkTargetSpacing , nIntervalDesired );
1215+ GetTargetSpacing (pindexLast-> nHeight ) , nIntervalDesired );
12161216 printf (" difficulty: Intervals of last 5/7/9/17 blocks = %" PRId64 " / %" PRId64 " / %" PRId64 " / %" PRId64 " .\n " ,
12171217 avgOf5, avgOf7, avgOf9, avgOf17);
12181218 printf (" difficulty: Difficulty Before Adjustment: %u %s\n " , pindexLast->nBits , bnOld.ToString ().c_str ());
@@ -1361,7 +1361,7 @@ unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfS
13611361 {
13621362 return GetNextTargetRequired_V2 (pindexLast, fProofOfStake , algo);
13631363 }
1364- return DarkGravityWave3 (pindexLast, nProofOfWorkTargetSpacing , algo);// Then DarkGravityWave3
1364+ return DarkGravityWave3 (pindexLast, GetTargetSpacing (pindexLast-> nHeight ) , algo);// Then DarkGravityWave3
13651365}
13661366
13671367
0 commit comments