| 1270 | } |
| 1271 | |
| 1272 | static RPCMethod verifychain() |
| 1273 | { |
| 1274 | return RPCMethod{ |
| 1275 | "verifychain", |
| 1276 | "Verifies blockchain database.\n", |
| 1277 | { |
| 1278 | {"checklevel", RPCArg::Type::NUM, RPCArg::DefaultHint{strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL)}, |
| 1279 | strprintf("How thorough the block verification is:\n%s", MakeUnorderedList(CHECKLEVEL_DOC))}, |
| 1280 | {"nblocks", RPCArg::Type::NUM, RPCArg::DefaultHint{strprintf("%d, 0=all", DEFAULT_CHECKBLOCKS)}, "The number of blocks to check."}, |
| 1281 | }, |
| 1282 | RPCResult{ |
| 1283 | RPCResult::Type::BOOL, "", "Verification finished successfully. If false, check debug log for reason."}, |
| 1284 | RPCExamples{ |
| 1285 | HelpExampleCli("verifychain", "") |
| 1286 | + HelpExampleRpc("verifychain", "") |
| 1287 | }, |
| 1288 | [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue |
| 1289 | { |
| 1290 | const int check_level{request.params[0].isNull() ? DEFAULT_CHECKLEVEL : request.params[0].getInt<int>()}; |
| 1291 | const int check_depth{request.params[1].isNull() ? DEFAULT_CHECKBLOCKS : request.params[1].getInt<int>()}; |
| 1292 | |
| 1293 | ChainstateManager& chainman = EnsureAnyChainman(request.context); |
| 1294 | LOCK(cs_main); |
| 1295 | |
| 1296 | Chainstate& active_chainstate = chainman.ActiveChainstate(); |
| 1297 | return CVerifyDB(chainman.GetNotifications()).VerifyDB( |
| 1298 | active_chainstate, chainman.GetParams().GetConsensus(), active_chainstate.CoinsTip(), check_level, check_depth) == VerifyDBResult::SUCCESS; |
| 1299 | }, |
| 1300 | }; |
| 1301 | } |
| 1302 | |
| 1303 | static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softforks, const ChainstateManager& chainman, Consensus::BuriedDeployment dep) |
| 1304 | { |
nothing calls this directly
no test coverage detected