diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -861,20 +861,12 @@ DEFAULT_CHECKBLOCKS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); - argsman.AddArg( - "-checklevel=", - 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); + argsman.AddArg("-checklevel=", + 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); argsman.AddArg("-checkblockindex", strprintf("Do a consistency check for the block tree, " "chainstate, and other validation data structures " diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1330,7 +1330,8 @@ { {"checklevel", RPCArg::Type::NUM, /* default */ strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL), - "How thorough the block verification is."}, + 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."}, diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -173,6 +174,8 @@ 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 CHECKLEVEL_DOC; class BlockValidationOptions { private: diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -65,6 +65,14 @@ static constexpr std::chrono::hours DATABASE_WRITE_INTERVAL{1}; /** Time to wait between flushing chainstate to disk. */ static constexpr std::chrono::hours DATABASE_FLUSH_INTERVAL{24}; +const std::vector 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", +}; ChainstateManager g_chainman;