aboutsummaryrefslogtreecommitdiff
path: root/src/pow.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2016-02-05 11:19:36 +0100
committerWladimir J. van der Laan <[email protected]>2016-02-05 11:19:45 +0100
commite7ea5db0c19085d871cd2d4a12ee98e44849572c (patch)
treeb8daece36f32651076d586b8c33586dd44fe0413 /src/pow.cpp
parentMerge #7468: [rpc-tests] Change solve() to use rehash (diff)
parentConsensus: Decouple pow.cpp from util.h (diff)
downloaddiscoin-e7ea5db0c19085d871cd2d4a12ee98e44849572c.tar.xz
discoin-e7ea5db0c19085d871cd2d4a12ee98e44849572c.zip
Merge #7459: Consensus: Decouple pow.o from util.o
f3757a0 Consensus: Decouple pow.cpp from util.h (Jorge Timón)
Diffstat (limited to 'src/pow.cpp')
-rw-r--r--src/pow.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/pow.cpp b/src/pow.cpp
index 40c72f9d7..058404f35 100644
--- a/src/pow.cpp
+++ b/src/pow.cpp
@@ -9,7 +9,6 @@
#include "chain.h"
#include "primitives/block.h"
#include "uint256.h"
-#include "util.h"
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
@@ -57,7 +56,6 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
// Limit adjustment step
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
- LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan);
if (nActualTimespan < params.nPowTargetTimespan/4)
nActualTimespan = params.nPowTargetTimespan/4;
if (nActualTimespan > params.nPowTargetTimespan*4)
@@ -75,12 +73,6 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
if (bnNew > bnPowLimit)
bnNew = bnPowLimit;
- /// debug print
- LogPrintf("GetNextWorkRequired RETARGET\n");
- LogPrintf("params.nPowTargetTimespan = %d nActualTimespan = %d\n", params.nPowTargetTimespan, nActualTimespan);
- LogPrintf("Before: %08x %s\n", pindexLast->nBits, bnOld.ToString());
- LogPrintf("After: %08x %s\n", bnNew.GetCompact(), bnNew.ToString());
-
return bnNew.GetCompact();
}
@@ -94,11 +86,11 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&
// Check range
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
- return error("CheckProofOfWork(): nBits below minimum work");
+ return false;
// Check proof of work matches claimed amount
if (UintToArith256(hash) > bnTarget)
- return error("CheckProofOfWork(): hash doesn't match nBits");
+ return false;
return true;
}