aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-06-10 10:29:44 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-10 10:33:12 +0200
commit8d9f0a60698e951ab1070432230c14e6fcbbfbf4 (patch)
tree0c93804bef5e2c7c130abb8e831209519ef03122 /src/main.cpp
parent9c93ee5ceb6001345a813ff2974b8d2692028037 (diff)
parentdce8360e44d5330cc9f9d09c9b09ac9237237204 (diff)
downloadbitcoin-8d9f0a60698e951ab1070432230c14e6fcbbfbf4.tar.xz
Merge pull request #5927
dce8360 Reduce checkpoints' effect on consensus. (Pieter Wuille)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index e9a5f7efd9..e92f64413a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1790,7 +1790,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
return true;
}
- bool fScriptChecks = (!fCheckpointsEnabled || pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate(chainparams.Checkpoints()));
+ bool fScriptChecks = true;
+ if (fCheckpointsEnabled) {
+ CBlockIndex *pindexLastCheckpoint = Checkpoints::GetLastCheckpoint(chainparams.Checkpoints());
+ if (pindexLastCheckpoint && pindexLastCheckpoint->GetAncestor(pindex->nHeight) == pindex) {
+ // This block is an ancestor of a checkpoint: disable script checks
+ fScriptChecks = false;
+ }
+ }
// Do not allow blocks that contain transactions which 'overwrite' older transactions,
// unless those are already completely spent.
@@ -2734,13 +2741,8 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
return state.Invalid(error("%s: block's timestamp is too early", __func__),
REJECT_INVALID, "time-too-old");
- if(fCheckpointsEnabled)
+ if (fCheckpointsEnabled)
{
- // Check that the block chain matches the known block chain up to a checkpoint
- if (!Checkpoints::CheckBlock(chainParams.Checkpoints(), nHeight, hash))
- return state.DoS(100, error("%s: rejected by checkpoint lock-in at %d", __func__, nHeight),
- REJECT_CHECKPOINT, "checkpoint mismatch");
-
// Don't accept any forks from the main chain prior to last checkpoint
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
if (pcheckpoint && nHeight < pcheckpoint->nHeight)