Changeset View
Changeset View
Standalone View
Standalone View
src/pow.cpp
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | static uint32_t GetNextEDAWorkRequired(const CBlockIndex *pindexPrev, | ||||
return nPow.GetCompact(); | return nPow.GetCompact(); | ||||
} | } | ||||
uint32_t GetNextWorkRequired(const CBlockIndex *pindexPrev, | uint32_t GetNextWorkRequired(const CBlockIndex *pindexPrev, | ||||
const CBlockHeader *pblock, const Config &config) { | const CBlockHeader *pblock, const Config &config) { | ||||
const Consensus::Params ¶ms = config.GetChainParams().GetConsensus(); | const Consensus::Params ¶ms = config.GetChainParams().GetConsensus(); | ||||
// Genesis block | // GetNextWorkRequired should never be called on the genesis block | ||||
if (pindexPrev == nullptr) { | assert(pindexPrev != nullptr); | ||||
return UintToArith256(params.powLimit).GetCompact(); | |||||
} | |||||
// Special rule for regtest: we never retarget. | // Special rule for regtest: we never retarget. | ||||
if (params.fPowNoRetargeting) { | if (params.fPowNoRetargeting) { | ||||
return pindexPrev->nBits; | return pindexPrev->nBits; | ||||
} | } | ||||
if (IsDAAEnabled(config, pindexPrev)) { | if (IsDAAEnabled(config, pindexPrev)) { | ||||
return GetNextCashWorkRequired(pindexPrev, pblock, config); | return GetNextCashWorkRequired(pindexPrev, pblock, config); | ||||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |