aboutsummaryrefslogtreecommitdiff
path: root/src/pow.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 14:29:12 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 14:33:22 +0100
commitf2ada138c28bf6b4f4a668c4ab60b55d124c9823 (patch)
treea8266e2f901e69384ceef9b305d23944e713d599 /src/pow.cpp
parentca6fb4e885c899e297e0a6fa723604a41f199aa6 (diff)
parent092b58d13d658baebbf03a6d5209f368f19e50a8 (diff)
downloadbitcoin-f2ada138c28bf6b4f4a668c4ab60b55d124c9823.tar.xz
Merge pull request #5170
092b58d CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> GetBlockProof(CBlockIndex) (jtimon) 22c4272 MOVEONLY: Move void UpdateTime() from pow.o to miner.o (plus fix include main.h -> chain.h) (jtimon)
Diffstat (limited to 'src/pow.cpp')
-rw-r--r--src/pow.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/pow.cpp b/src/pow.cpp
index af7fc488ef..e07e7ff770 100644
--- a/src/pow.cpp
+++ b/src/pow.cpp
@@ -5,10 +5,9 @@
#include "pow.h"
+#include "chain.h"
#include "chainparams.h"
#include "core/block.h"
-#include "main.h"
-#include "timedata.h"
#include "uint256.h"
#include "util.h"
@@ -98,21 +97,12 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits)
return true;
}
-void UpdateTime(CBlockHeader* pblock, const CBlockIndex* pindexPrev)
-{
- pblock->nTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
-
- // Updating time can change work required on testnet:
- if (Params().AllowMinDifficultyBlocks())
- pblock->nBits = GetNextWorkRequired(pindexPrev, pblock);
-}
-
-uint256 GetProofIncrement(unsigned int nBits)
+uint256 GetBlockProof(const CBlockIndex& block)
{
uint256 bnTarget;
bool fNegative;
bool fOverflow;
- bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
+ bnTarget.SetCompact(block.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