| 1133 | } |
| 1134 | |
| 1135 | static UniValue verifychain(const JSONRPCRequest& request) |
| 1136 | { |
| 1137 | int nCheckLevel = gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL); |
| 1138 | int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS); |
| 1139 | if (request.fHelp || request.params.size() > 2) |
| 1140 | throw std::runtime_error( |
| 1141 | "verifychain ( checklevel nblocks )\n" |
| 1142 | "\nVerifies blockchain database.\n" |
| 1143 | "\nArguments:\n" |
| 1144 | "1. checklevel (numeric, optional, 0-4, default=" + strprintf("%d", nCheckLevel) + ") How thorough the block verification is.\n" |
| 1145 | "2. nblocks (numeric, optional, default=" + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check.\n" |
| 1146 | "\nResult:\n" |
| 1147 | "true|false (boolean) Verified or not\n" |
| 1148 | "\nExamples:\n" |
| 1149 | + HelpExampleCli("verifychain", "") |
| 1150 | + HelpExampleRpc("verifychain", "") |
| 1151 | ); |
| 1152 | |
| 1153 | LOCK(cs_main); |
| 1154 | |
| 1155 | if (!request.params[0].isNull()) |
| 1156 | nCheckLevel = request.params[0].get_int(); |
| 1157 | if (!request.params[1].isNull()) |
| 1158 | nCheckDepth = request.params[1].get_int(); |
| 1159 | |
| 1160 | return CVerifyDB().VerifyDB(Params(), pcoinsTip.get(), nCheckLevel, nCheckDepth); |
| 1161 | } |
| 1162 | |
| 1163 | /** Implementation of IsSuperMajority with better feedback */ |
| 1164 | static UniValue SoftForkMajorityDesc(int version, CBlockIndex* pindex, const Consensus::Params& consensusParams) |
nothing calls this directly
no test coverage detected