aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-08-27 22:35:14 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-08-27 22:39:28 +0200
commitd1062e32fa66db44d0302bbff9d5634f5c698155 (patch)
tree5b7db2bc339f6d474594c8fe77b710751cdbb5cd /src/main.h
parentcd3d80be677a3e9c4e1373c364c65f9d09439021 (diff)
parent654871d43677947d124673c9e0dd2984f0d3ca61 (diff)
Merge pull request #4377
654871d replace ComputeMinWork with CheckMinWork (jtimon) b343c1a Move CBlockIndex::GetBlockWork() to pow::GetProofIncrement(nBits) (jtimon) c2c02f3 Move UpdateTime to pow (jtimon)
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/main.h b/src/main.h
index 142c41444e..0a1ff45460 100644
--- a/src/main.h
+++ b/src/main.h
@@ -14,6 +14,7 @@
#include "coins.h"
#include "core.h"
#include "net.h"
+#include "pow.h"
#include "script.h"
#include "sync.h"
#include "txmempool.h"
@@ -163,8 +164,6 @@ bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock, b
bool ActivateBestChain(CValidationState &state, CBlock *pblock = NULL);
int64_t GetBlockValue(int nHeight, int64_t nFees);
-void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev);
-
/** Create a new block index entry for a given block hash */
CBlockIndex * InsertBlockIndex(uint256 hash);
/** Verify a signature */
@@ -736,17 +735,7 @@ public:
uint256 GetBlockWork() const
{
- uint256 bnTarget;
- bool fNegative;
- bool fOverflow;
- bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
- if (fNegative || fOverflow || bnTarget == 0)
- return 0;
- // We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256
- // as it's too large for a uint256. However, as 2**256 is at least as large
- // as bnTarget+1, it is equal to ((2**256 - bnTarget - 1) / (bnTarget+1)) + 1,
- // or ~bnTarget / (nTarget+1) + 1.
- return (~bnTarget / (bnTarget + 1)) + 1;
+ return GetProofIncrement(nBits);
}
enum { nMedianTimeSpan=11 };