unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { if (pindexLast->nHeight <= 101631) { return GetNextWorkRequiredV1(pindexLast, pblock, params); } else if (pindexLast->nHeight > 101631 && pindexLast->nHeight != 137161 && pindexLast->nHeight <= 181200) { return GetNextWorkRequiredEMA(pindexLast, pblock, params); } else if (pindexLast->nHeight == 137161) { return (0x1b034c51); } else if (pindexLast->nHeight > 181200 && pindexLast->nHeight < 806000) { return GetNextWorkRequiredV2(pindexLast, pblock, params); } else { return DarkGravityWave(pindexLast, params); } return GetNextWorkRequiredV2(pindexLast, pblock, params); }
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params, int algo) { // Genesis block if (pindexLast == nullptr) return InitialDifficulty(params, algo); if (params.fPowAllowMinDifficultyBlocks) { // Special difficulty rule for testnet: // If the new block's timestamp is more than 2 minutes // then allow mining of a min-difficulty block. if (pblock->nTime > pindexLast->nTime + params.nTargetSpacing*2) return PowLimit(params); } if (pindexLast->nHeight < params.multiAlgoDiffChangeTarget) return GetNextWorkRequiredV1(pindexLast, params, algo); else if (pindexLast->nHeight < params.alwaysUpdateDiffChangeTarget){ return GetNextWorkRequiredV2(pindexLast, params, algo); } else if(pindexLast->nHeight < params.workComputationChangeTarget) return GetNextWorkRequiredV3(pindexLast, params, algo); else return GetNextWorkRequiredV4(pindexLast, params, algo); }