mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
RPC: add 'verifychain', to verify chain database at runtime
This commit is contained in:
@@ -243,4 +243,20 @@ Value gettxout(const Array& params, bool fHelp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
Value verifychain(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"verifychain [check level] [num blocks]\n"
|
||||
"Verifies blockchain database.");
|
||||
|
||||
int nCheckLevel = GetArg("-checklevel", 3);
|
||||
int nCheckDepth = GetArg("-checkblocks", 288);
|
||||
if (params.size() > 0)
|
||||
nCheckLevel = params[0].get_int();
|
||||
if (params.size() > 1)
|
||||
nCheckDepth = params[1].get_int();
|
||||
|
||||
return VerifyDB(nCheckLevel, nCheckDepth);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user