Correct PoW calculation logic to use locally calcualted difficulty

This commit is contained in:
Ross Nicoll 2017-11-19 22:10:34 +00:00
parent 1de15c70ce
commit 0a403a2227

View file

@ -58,9 +58,9 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
// Litecoin: This fixes an issue where a 51% attack can change difficulty at will.
// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
int blockstogoback = params.DifficultyAdjustmentInterval()-1;
if ((pindexLast->nHeight+1) != params.DifficultyAdjustmentInterval())
blockstogoback = params.DifficultyAdjustmentInterval();
int blockstogoback = difficultyAdjustmentInterval-1;
if ((pindexLast->nHeight+1) != difficultyAdjustmentInterval)
blockstogoback = difficultyAdjustmentInterval;
// Go back by what we want to be 14 days worth of blocks
int nHeightFirst = pindexLast->nHeight - blockstogoback;