aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-07-20 17:33:34 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-07-20 17:34:54 +0200
commit7c2400cb8ab7ebd5fe374b1f69657e0b0718ab73 (patch)
treec3ba3d83cda07628d21720436a295be08fcfe446 /src
parent041dad94b047313a17edb0324742cf80cfd550f1 (diff)
parentd9d1bd3267cf0f9fc6f56250bd8cd3af7596c11e (diff)
Merge #10775: nCheckDepth chain height fix
d9d1bd3 nCheckDepth chain height fix (romanornr) Pull request description: ```` if (nCheckDepth <= 0) nCheckDepth = 1000000000; // suffices until the year 19000 if (nCheckDepth > chainActive.Height()) nCheckDepth = chainActive.Height(); ```` These lines confuse me. Correct me if I am wrong, but we can't check any more blocks than we have right? If someone requests <= 0 it get set it into some huge number and then immediately limit it to the chain height in the following statement. ```` if (nCheckDepth > chainActive.Height()) nCheckDepth = chainActive.Height(); ```` when using ````--checkblocks=Z```` When Z is ````0```` or any other negative number, it will check all blocks. I think it should be changed to this maybe. ```` if (nCheckDepth <= 0 || nCheckDepth > chainActive.Height()) nCheckDepth = chainActive.Height(); ```` Which gets rid of that huge number which is confusing for any other altcoins that have a different block time. Tree-SHA512: 8ee0ae5f33b399fa74dc16926709694ccfe1fc8a043cba2f5d00884220ac1b9b13f2df4588041f4133be634e5c7b14f4eebe24294028dafe91581a97dbe627f3
Diffstat (limited to 'src')
-rw-r--r--src/validation.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index d7d880d24f..9a00203e8f 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3573,9 +3573,7 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
return true;
// Verify blocks in the best chain
- if (nCheckDepth <= 0)
- nCheckDepth = 1000000000; // suffices until the year 19000
- if (nCheckDepth > chainActive.Height())
+ if (nCheckDepth <= 0 || nCheckDepth > chainActive.Height())
nCheckDepth = chainActive.Height();
nCheckLevel = std::max(0, std::min(4, nCheckLevel));
LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel);