aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalvin Kim <calvin@kcalvinalvin.info>2020-05-30 21:52:47 +0900
committerCalvin Kim <calvin@kcalvinalvin.info>2020-06-07 17:50:22 +0900
commit501e6ab4e778d8f4e95fdc807eeb8644df16203b (patch)
treed62143ee1b4c872af37d43e9f435523bfafe3b71 /src
parent76e64525ff38eaedccf8c2b847eccfffb69be27f (diff)
downloadbitcoin-501e6ab4e778d8f4e95fdc807eeb8644df16203b.tar.xz
doc: Add documentation for 'checklevel' argument in 'verifychain' RPC call
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp9
-rw-r--r--src/rpc/blockchain.cpp3
-rw-r--r--src/validation.cpp8
-rw-r--r--src/validation.h3
4 files changed, 14 insertions, 9 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 37e6251295..7b5330e31e 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -502,14 +502,7 @@ void SetupServerArgs(NodeContext& node)
#endif
gArgs.AddArg("-checkblocks=<n>", strprintf("How many blocks to check at startup (default: %u, 0 = all)", DEFAULT_CHECKBLOCKS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
- gArgs.AddArg("-checklevel=<n>", strprintf("How thorough the block verification of -checkblocks is: "
- "level 0 reads the blocks from disk, "
- "level 1 verifies block validity, "
- "level 2 verifies undo data, "
- "level 3 checks disconnection of tip blocks, "
- "and level 4 tries to reconnect the blocks, "
- "each level includes the checks of the previous levels "
- "(0-4, default: %u)", DEFAULT_CHECKLEVEL), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
+ gArgs.AddArg("-checklevel=<n>", strprintf("How thorough the block verification of -checkblocks is: %s (0-4, default: %u)", Join(CHECKLEVEL_DOC, ", "), DEFAULT_CHECKLEVEL), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checkblockindex", strprintf("Do a consistency check for the block tree, chainstate, and other validation data structures occasionally. (default: %u, regtest: %u)", defaultChainParams->DefaultConsistencyChecks(), regtestChainParams->DefaultConsistencyChecks()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checkmempool=<n>", strprintf("Run checks every <n> transactions (default: %u, regtest: %u)", defaultChainParams->DefaultConsistencyChecks(), regtestChainParams->DefaultConsistencyChecks()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checkpoints", strprintf("Enable rejection of any forks from the known historical chain until block 295000 (default: %u)", DEFAULT_CHECKPOINTS_ENABLED), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index b0936cef5a..eedb1c3d71 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1095,7 +1095,8 @@ static UniValue verifychain(const JSONRPCRequest& request)
RPCHelpMan{"verifychain",
"\nVerifies blockchain database.\n",
{
- {"checklevel", RPCArg::Type::NUM, /* default */ strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL), "How thorough the block verification is."},
+ {"checklevel", RPCArg::Type::NUM, /* default */ strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL),
+ strprintf("How thorough the block verification is:\n - %s", Join(CHECKLEVEL_DOC, "\n- "))},
{"nblocks", RPCArg::Type::NUM, /* default */ strprintf("%d, 0=all", DEFAULT_CHECKBLOCKS), "The number of blocks to check."},
},
RPCResult{
diff --git a/src/validation.cpp b/src/validation.cpp
index 1e6fa0b394..c8eec1faa9 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -77,6 +77,14 @@ static constexpr std::chrono::hours DATABASE_WRITE_INTERVAL{1};
static constexpr std::chrono::hours DATABASE_FLUSH_INTERVAL{24};
/** Maximum age of our tip for us to be considered current for fee estimation */
static constexpr std::chrono::hours MAX_FEE_ESTIMATION_TIP_AGE{3};
+const std::vector<std::string> CHECKLEVEL_DOC {
+ "level 0 reads the blocks from disk",
+ "level 1 verifies block validity",
+ "level 2 verifies undo data",
+ "level 3 checks disconnection of tip blocks",
+ "level 4 tries to reconnect the blocks",
+ "each level includes the checks of the previous levels",
+};
bool CBlockIndexWorkComparator::operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
// First sort by most total work, ...
diff --git a/src/validation.h b/src/validation.h
index 8112e38704..e403bcb51a 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -29,6 +29,7 @@
#include <memory>
#include <set>
#include <stdint.h>
+#include <string>
#include <utility>
#include <vector>
@@ -149,6 +150,8 @@ extern bool fHavePruned;
extern bool fPruneMode;
/** Number of MiB of block files that we're trying to stay below. */
extern uint64_t nPruneTarget;
+/** Documentation for argument 'checklevel'. */
+extern const std::vector<std::string> CHECKLEVEL_DOC;
/** Open a block file (blk?????.dat) */
FILE* OpenBlockFile(const FlatFilePos &pos, bool fReadOnly = false);