diff options
Diffstat (limited to 'src/pow.cpp')
| -rw-r--r-- | src/pow.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/pow.cpp b/src/pow.cpp index af7fc488e..e91e3d893 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -1,14 +1,13 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Copyright (c) 2009-2014 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "pow.h" +#include "chain.h" #include "chainparams.h" -#include "core/block.h" -#include "main.h" -#include "timedata.h" +#include "primitives/block.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 |