| 1541 | } |
| 1542 | |
| 1543 | static 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 | |
| 1573 | static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softforks, const Consensus::Params& params, Consensus::BuriedDeployment dep) |
| 1574 | { |
nothing calls this directly
no test coverage detected