diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2014-08-27 22:35:14 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2014-08-27 22:39:28 +0200 |
commit | d1062e32fa66db44d0302bbff9d5634f5c698155 (patch) | |
tree | 5b7db2bc339f6d474594c8fe77b710751cdbb5cd /src/main.cpp | |
parent | cd3d80be677a3e9c4e1373c364c65f9d09439021 (diff) | |
parent | 654871d43677947d124673c9e0dd2984f0d3ca61 (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.cpp')
-rw-r--r-- | src/main.cpp | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/src/main.cpp b/src/main.cpp index c7ba15ef13..ddc37ea534 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1420,25 +1420,6 @@ void static InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state } } -void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev) -{ - block.nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); - - // Updating time can change work required on testnet: - if (Params().AllowMinDifficultyBlocks()) - block.nBits = GetNextWorkRequired(pindexPrev, &block); -} - - - - - - - - - - - void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight) { bool ret; @@ -2435,12 +2416,7 @@ bool AcceptBlockHeader(CBlockHeader& block, CValidationState& state, CBlockIndex return state.DoS(100, error("CheckBlockHeader() : block with timestamp before last checkpoint"), REJECT_CHECKPOINT, "time-too-old"); } - bool fOverflow = false; - uint256 bnNewBlock; - bnNewBlock.SetCompact(block.nBits, NULL, &fOverflow); - uint256 bnRequired; - bnRequired.SetCompact(ComputeMinWork(pcheckpoint->nBits, deltaTime)); - if (fOverflow || bnNewBlock > bnRequired) + if (!CheckMinWork(block.nBits, pcheckpoint->nBits, deltaTime)) { return state.DoS(100, error("CheckBlockHeader() : block with too little proof-of-work"), REJECT_INVALID, "bad-diffbits"); @@ -3297,15 +3273,6 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) return nLoaded > 0; } - - - - - - - - - ////////////////////////////////////////////////////////////////////////////// // // CAlert |