aboutsummaryrefslogtreecommitdiff
path: root/src/pow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pow.cpp')
-rw-r--r--src/pow.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pow.cpp b/src/pow.cpp
index 6dd5c4c12c..eb899ffc94 100644
--- a/src/pow.cpp
+++ b/src/pow.cpp
@@ -48,8 +48,13 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
pindexFirst = pindexFirst->pprev;
assert(pindexFirst);
+ return CalculateNextWorkRequired(pindexLast, pindexFirst->GetBlockTime());
+}
+
+unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime)
+{
// Limit adjustment step
- int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+ int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan);
if (nActualTimespan < Params().TargetTimespan()/4)
nActualTimespan = Params().TargetTimespan()/4;
@@ -82,9 +87,6 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits)
bool fOverflow;
arith_uint256 bnTarget;
- if (Params().SkipProofOfWorkCheck())
- return true;
-
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
// Check range