Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,314 Lines • ▼ Show 20 Lines | UniValue gettxout(const Config &config, const JSONRPCRequest &request) { | ||||
ret.pushKV("scriptPubKey", o); | ret.pushKV("scriptPubKey", o); | ||||
ret.pushKV("coinbase", coin.IsCoinBase()); | ret.pushKV("coinbase", coin.IsCoinBase()); | ||||
return ret; | return ret; | ||||
} | } | ||||
static UniValue verifychain(const Config &config, | static UniValue verifychain(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
int nCheckLevel = gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL); | |||||
int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS); | |||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"verifychain", | "verifychain", | ||||
"Verifies blockchain database.\n", | "Verifies blockchain database.\n", | ||||
{ | { | ||||
{"checklevel", RPCArg::Type::NUM, | {"checklevel", RPCArg::Type::NUM, | ||||
/* default */ strprintf("%d, range=0-4", nCheckLevel), | /* default */ strprintf("%d, range=0-4", DEFAULT_CHECKLEVEL), | ||||
"How thorough the block verification is."}, | "How thorough the block verification is."}, | ||||
{"nblocks", RPCArg::Type::NUM, | {"nblocks", RPCArg::Type::NUM, | ||||
/* default */ strprintf("%d, 0=all", nCheckDepth), | /* default */ strprintf("%d, 0=all", DEFAULT_CHECKBLOCKS), | ||||
"The number of blocks to check."}, | "The number of blocks to check."}, | ||||
}, | }, | ||||
RPCResult{RPCResult::Type::BOOL, "", "Verified or not"}, | RPCResult{RPCResult::Type::BOOL, "", "Verified or not"}, | ||||
RPCExamples{HelpExampleCli("verifychain", "") + | RPCExamples{HelpExampleCli("verifychain", "") + | ||||
HelpExampleRpc("verifychain", "")}, | HelpExampleRpc("verifychain", "")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
LOCK(cs_main); | const int check_level(request.params[0].isNull() | ||||
? DEFAULT_CHECKLEVEL | |||||
: request.params[0].get_int()); | |||||
const int check_depth{request.params[1].isNull() | |||||
? DEFAULT_CHECKBLOCKS | |||||
: request.params[1].get_int()}; | |||||
if (!request.params[0].isNull()) { | LOCK(cs_main); | ||||
nCheckLevel = request.params[0].get_int(); | |||||
} | |||||
if (!request.params[1].isNull()) { | |||||
nCheckDepth = request.params[1].get_int(); | |||||
} | |||||
return CVerifyDB().VerifyDB(config, &::ChainstateActive().CoinsTip(), | return CVerifyDB().VerifyDB(config, &::ChainstateActive().CoinsTip(), | ||||
nCheckLevel, nCheckDepth); | check_level, check_depth); | ||||
} | } | ||||
static void BIP9SoftForkDescPushBack(UniValue &softforks, | static void BIP9SoftForkDescPushBack(UniValue &softforks, | ||||
const Consensus::Params &consensusParams, | const Consensus::Params &consensusParams, | ||||
Consensus::DeploymentPos id) | Consensus::DeploymentPos id) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | ||||
// For BIP9 deployments. | // For BIP9 deployments. | ||||
// Deployments (e.g. testdummy) with timeout value before Jan 1, 2009 are | // Deployments (e.g. testdummy) with timeout value before Jan 1, 2009 are | ||||
▲ Show 20 Lines • Show All 1,614 Lines • Show Last 20 Lines |