Merge #5799: Rename Interval() to DifficultyAdjustmentInterval()

e5ece05 Rename Interval() to DifficultyAdjustmentInterval() (Shaul Kfir)
This commit is contained in:
Wladimir J. van der Laan 2015-02-18 17:29:17 +01:00
commit 8d0418720c
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
3 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ public:
bool RequireStandard() const { return fRequireStandard; } bool RequireStandard() const { return fRequireStandard; }
int64_t TargetTimespan() const { return nTargetTimespan; } int64_t TargetTimespan() const { return nTargetTimespan; }
int64_t TargetSpacing() const { return nTargetSpacing; } int64_t TargetSpacing() const { return nTargetSpacing; }
int64_t Interval() const { return nTargetTimespan / nTargetSpacing; } int64_t DifficultyAdjustmentInterval() const { return nTargetTimespan / nTargetSpacing; }
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */ /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; } bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
/** In the future use NetworkIDString() for RPC fields */ /** In the future use NetworkIDString() for RPC fields */

View File

@ -20,8 +20,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
if (pindexLast == NULL) if (pindexLast == NULL)
return nProofOfWorkLimit; return nProofOfWorkLimit;
// Only change once per interval // Only change once per difficulty adjustment interval
if ((pindexLast->nHeight+1) % Params().Interval() != 0) if ((pindexLast->nHeight+1) % Params().DifficultyAdjustmentInterval() != 0)
{ {
if (Params().AllowMinDifficultyBlocks()) if (Params().AllowMinDifficultyBlocks())
{ {
@ -34,7 +34,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
{ {
// Return the last non-special-min-difficulty-rules-block // Return the last non-special-min-difficulty-rules-block
const CBlockIndex* pindex = pindexLast; const CBlockIndex* pindex = pindexLast;
while (pindex->pprev && pindex->nHeight % Params().Interval() != 0 && pindex->nBits == nProofOfWorkLimit) while (pindex->pprev && pindex->nHeight % Params().DifficultyAdjustmentInterval() != 0 && pindex->nBits == nProofOfWorkLimit)
pindex = pindex->pprev; pindex = pindex->pprev;
return pindex->nBits; return pindex->nBits;
} }
@ -44,7 +44,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
// Go back by what we want to be 14 days worth of blocks // Go back by what we want to be 14 days worth of blocks
const CBlockIndex* pindexFirst = pindexLast; const CBlockIndex* pindexFirst = pindexLast;
for (int i = 0; pindexFirst && i < Params().Interval()-1; i++) for (int i = 0; pindexFirst && i < Params().DifficultyAdjustmentInterval()-1; i++)
pindexFirst = pindexFirst->pprev; pindexFirst = pindexFirst->pprev;
assert(pindexFirst); assert(pindexFirst);

View File

@ -44,7 +44,7 @@ Value GetNetworkHashPS(int lookup, int height) {
// If lookup is -1, then use blocks since last difficulty change. // If lookup is -1, then use blocks since last difficulty change.
if (lookup <= 0) if (lookup <= 0)
lookup = pb->nHeight % Params().Interval() + 1; lookup = pb->nHeight % Params().DifficultyAdjustmentInterval() + 1;
// If lookup is larger than chain, then set it to chain length. // If lookup is larger than chain, then set it to chain length.
if (lookup > pb->nHeight) if (lookup > pb->nHeight)