Skip to content

Commit 501e6ab

Browse files
committed
doc: Add documentation for 'checklevel' argument in 'verifychain' RPC call
1 parent 76e6452 commit 501e6ab

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/init.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,7 @@ void SetupServerArgs(NodeContext& node)
502502
#endif
503503

504504
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);
505-
gArgs.AddArg("-checklevel=<n>", strprintf("How thorough the block verification of -checkblocks is: "
506-
"level 0 reads the blocks from disk, "
507-
"level 1 verifies block validity, "
508-
"level 2 verifies undo data, "
509-
"level 3 checks disconnection of tip blocks, "
510-
"and level 4 tries to reconnect the blocks, "
511-
"each level includes the checks of the previous levels "
512-
"(0-4, default: %u)", DEFAULT_CHECKLEVEL), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
505+
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);
513506
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);
514507
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);
515508
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);

src/rpc/blockchain.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,8 @@ static UniValue verifychain(const JSONRPCRequest& request)
10951095
RPCHelpMan{"verifychain",
10961096
"\nVerifies blockchain database.\n",
10971097
{
1098-
{"checklevel", RPCArg::Type::NUM, /* default */ strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL), "How thorough the block verification is."},
1098+
{"checklevel", RPCArg::Type::NUM, /* default */ strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL),
1099+
strprintf("How thorough the block verification is:\n - %s", Join(CHECKLEVEL_DOC, "\n- "))},
10991100
{"nblocks", RPCArg::Type::NUM, /* default */ strprintf("%d, 0=all", DEFAULT_CHECKBLOCKS), "The number of blocks to check."},
11001101
},
11011102
RPCResult{

src/validation.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ static constexpr std::chrono::hours DATABASE_WRITE_INTERVAL{1};
7777
static constexpr std::chrono::hours DATABASE_FLUSH_INTERVAL{24};
7878
/** Maximum age of our tip for us to be considered current for fee estimation */
7979
static constexpr std::chrono::hours MAX_FEE_ESTIMATION_TIP_AGE{3};
80+
const std::vector<std::string> CHECKLEVEL_DOC {
81+
"level 0 reads the blocks from disk",
82+
"level 1 verifies block validity",
83+
"level 2 verifies undo data",
84+
"level 3 checks disconnection of tip blocks",
85+
"level 4 tries to reconnect the blocks",
86+
"each level includes the checks of the previous levels",
87+
};
8088

8189
bool CBlockIndexWorkComparator::operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
8290
// First sort by most total work, ...

src/validation.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <memory>
3030
#include <set>
3131
#include <stdint.h>
32+
#include <string>
3233
#include <utility>
3334
#include <vector>
3435

@@ -149,6 +150,8 @@ extern bool fHavePruned;
149150
extern bool fPruneMode;
150151
/** Number of MiB of block files that we're trying to stay below. */
151152
extern uint64_t nPruneTarget;
153+
/** Documentation for argument 'checklevel'. */
154+
extern const std::vector<std::string> CHECKLEVEL_DOC;
152155

153156
/** Open a block file (blk?????.dat) */
154157
FILE* OpenBlockFile(const FlatFilePos &pos, bool fReadOnly = false);

0 commit comments

Comments
 (0)