aboutsummaryrefslogtreecommitdiff
path: root/src/rpcblockchain.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@bitpay.com>2013-06-19 11:53:02 -0400
committerJeff Garzik <jgarzik@bitpay.com>2013-06-19 11:53:02 -0400
commitf590653377d5ee18c05894a58d226b5d2531077b (patch)
tree465961b78de57ed8f58b5942c2f1bb64d3de7b25 /src/rpcblockchain.cpp
parent168ba993921c2c1a21cad1f03a331f7c01c67079 (diff)
RPC: add 'verifychain', to verify chain database at runtime
Diffstat (limited to 'src/rpcblockchain.cpp')
-rw-r--r--src/rpcblockchain.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index a0ddc4d9ee..6b2ef8315f 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -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);
+}