From 22c4272bf4ea04689fc0ea08e637caa46ba12c98 Mon Sep 17 00:00:00 2001 From: jtimon Date: Wed, 22 Oct 2014 01:31:01 +0200 Subject: MOVEONLY: Move void UpdateTime() from pow.o to miner.o (plus fix include main.h -> chain.h) --- src/pow.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/pow.cpp') diff --git a/src/pow.cpp b/src/pow.cpp index af7fc488ef..483122a76a 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,15 +97,6 @@ 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 bnTarget; -- cgit v1.2.3 From 092b58d13d658baebbf03a6d5209f368f19e50a8 Mon Sep 17 00:00:00 2001 From: jtimon Date: Wed, 29 Oct 2014 17:00:02 +0100 Subject: CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> GetBlockProof(CBlockIndex) --- src/pow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pow.cpp') diff --git a/src/pow.cpp b/src/pow.cpp index 483122a76a..e07e7ff770 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -97,12 +97,12 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits) return true; } -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 -- cgit v1.2.3