25 if (pindexLast->
nHeight < 157500)
37 if (pindexLast == NULL)
38 return nProofOfWorkLimit;
46 return nProofOfWorkLimit;
50 bool fNewDifficultyProtocol = (pindexLast->
nHeight >= 145000);
51 const int64_t difficultyAdjustmentInterval = fNewDifficultyProtocol
54 if ((pindexLast->
nHeight+1) % difficultyAdjustmentInterval != 0)
62 return nProofOfWorkLimit;
68 pindex = pindex->
pprev;
72 return pindexLast->
nBits;
77 int blockstogoback = difficultyAdjustmentInterval-1;
78 if ((pindexLast->
nHeight+1) != difficultyAdjustmentInterval)
79 blockstogoback = difficultyAdjustmentInterval;
82 int nHeightFirst = pindexLast->
nHeight - blockstogoback;
83 assert(nHeightFirst >= 0);
93 return pindexLast->
nBits;
96 int64_t nActualTimespan = pindexLast->
GetBlockTime() - nFirstBlockTime;
106 bnNew *= nActualTimespan;
109 if (bnNew > bnPowLimit)
121 bnTarget.
SetCompact(nBits, &fNegative, &fOverflow);
arith_uint256 UintToArith256(const uint256 &a)
The block chain is a tree shaped structure starting with the genesis block at the root,...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
int64_t GetBlockTime() const
CBlockIndex * GetAncestor(int height)
Efficiently find an ancestor of this block.
int nHeight
height of the entry in the chain. The genesis block has height 0
256-bit unsigned big integer.
uint32_t GetCompact(bool fNegative=false) const
arith_uint256 & SetCompact(uint32_t nCompact, bool *pfNegative=NULL, bool *pfOverflow=NULL)
The "compact" format is a representation of a whole number N using an unsigned 32bit number similar t...
unsigned int CalculateDogecoinNextWorkRequired(const CBlockIndex *pindexLast, int64_t nFirstBlockTime, const Consensus::Params ¶ms)
bool AllowDigishieldMinDifficultyForBlock(const CBlockIndex *pindexLast, const CBlockHeader *pblock, const Consensus::Params ¶ms)
bool AllowMinDifficultyForBlock(const CBlockIndex *pindexLast, const CBlockHeader *pblock, const Consensus::Params ¶ms)
unsigned int GetNextWorkRequired(const CBlockIndex *pindexLast, const CBlockHeader *pblock, const Consensus::Params ¶ms)
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
unsigned int CalculateNextWorkRequired(const CBlockIndex *pindexLast, int64_t nFirstBlockTime, const Consensus::Params ¶ms)
Parameters that influence chain consensus.
int64_t DifficultyAdjustmentInterval() const
int64_t nPowTargetTimespan
uint256 powLimit
Proof of work parameters.
int64_t nPowTargetSpacing
bool fPowAllowMinDifficultyBlocks