Merge pull request #2778 from jgarzik/rpc-verifydb

RPC: add 'verifychain' to verify chain database at runtime
This commit is contained in:
Jeff Garzik
2013-06-22 23:08:13 -07:00
6 changed files with 26 additions and 6 deletions

View File

@@ -2686,14 +2686,13 @@ bool static LoadBlockIndexDB()
return true;
}
bool VerifyDB() {
bool VerifyDB(int nCheckLevel, int nCheckDepth)
{
if (pindexBest == NULL || pindexBest->pprev == NULL)
return true;
// Verify blocks in the best chain
int nCheckLevel = GetArg("-checklevel", 3);
int nCheckDepth = GetArg( "-checkblocks", 288);
if (nCheckDepth == 0)
if (nCheckDepth <= 0)
nCheckDepth = 1000000000; // suffices until the year 19000
if (nCheckDepth > nBestHeight)
nCheckDepth = nBestHeight;