MCPcopy Create free account
hub / github.com/ElementsProject/elements / verifychain

Function verifychain

src/rpc/blockchain.cpp:1543–1571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1541}
1542
1543static RPCHelpMan verifychain()
1544{
1545 return RPCHelpMan{"verifychain",
1546 "\nVerifies blockchain database.\n",
1547 {
1548 {"checklevel", RPCArg::Type::NUM, RPCArg::DefaultHint{strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL)},
1549 strprintf("How thorough the block verification is:\n%s", MakeUnorderedList(CHECKLEVEL_DOC))},
1550 {"nblocks", RPCArg::Type::NUM, RPCArg::DefaultHint{strprintf("%d, 0=all", DEFAULT_CHECKBLOCKS)}, "The number of blocks to check."},
1551 },
1552 RPCResult{
1553 RPCResult::Type::BOOL, "", "Verified or not"},
1554 RPCExamples{
1555 HelpExampleCli("verifychain", "")
1556 + HelpExampleRpc("verifychain", "")
1557 },
1558 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
1559{
1560 const int check_level{request.params[0].isNull() ? DEFAULT_CHECKLEVEL : request.params[0].get_int()};
1561 const int check_depth{request.params[1].isNull() ? DEFAULT_CHECKBLOCKS : request.params[1].get_int()};
1562
1563 ChainstateManager& chainman = EnsureAnyChainman(request.context);
1564 LOCK(cs_main);
1565
1566 CChainState& active_chainstate = chainman.ActiveChainstate();
1567 return CVerifyDB().VerifyDB(
1568 active_chainstate, Params().GetConsensus(), active_chainstate.CoinsTip(), check_level, check_depth);
1569},
1570 };
1571}
1572
1573static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softforks, const Consensus::Params& params, Consensus::BuriedDeployment dep)
1574{

Callers

nothing calls this directly

Calls 8

MakeUnorderedListFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
CVerifyDBClass · 0.85
get_intMethod · 0.80
VerifyDBMethod · 0.80
ParamsClass · 0.50
isNullMethod · 0.45

Tested by

no test coverage detected