Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,111 Lines • ▼ Show 20 Lines | static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats) { | ||||
stats.hashSerialized = ss.GetHash(); | stats.hashSerialized = ss.GetHash(); | ||||
stats.nDiskSize = view->EstimateSize(); | stats.nDiskSize = view->EstimateSize(); | ||||
return true; | return true; | ||||
} | } | ||||
static UniValue pruneblockchain(const Config &config, | static UniValue pruneblockchain(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error(RPCHelpMan{ | ||||
RPCHelpMan{ | |||||
"pruneblockchain", | "pruneblockchain", | ||||
"", | "", | ||||
{ | { | ||||
{"height", RPCArg::Type::NUM, /* opt */ false, | {"height", RPCArg::Type::NUM, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The block height to prune up to. May be set to a " | "The block height to prune up to. May be set to a discrete " | ||||
"discrete height, or a unix timestamp\n" | "height, or a unix timestamp\n" | ||||
" to prune blocks whose block time is at " | " to prune blocks whose block time is at " | ||||
"least 2 hours older than the provided timestamp."}, | "least 2 hours older than the provided timestamp."}, | ||||
}} | }, | ||||
.ToString() + | RPCResult{"n (numeric) Height of the last block pruned.\n"}, | ||||
"\nResult:\n" | RPCExamples{HelpExampleCli("pruneblockchain", "1000") + | ||||
"n (numeric) Height of the last block pruned.\n" | HelpExampleRpc("pruneblockchain", "1000")}, | ||||
"\nExamples:\n" + | } | ||||
HelpExampleCli("pruneblockchain", "1000") + | .ToStringWithResultsAndExamples()); | ||||
HelpExampleRpc("pruneblockchain", "1000")); | |||||
} | } | ||||
if (!fPruneMode) { | if (!fPruneMode) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_MISC_ERROR, | RPC_MISC_ERROR, | ||||
"Cannot prune blocks because node is not in prune mode."); | "Cannot prune blocks because node is not in prune mode."); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,673 Lines • Show Last 20 Lines |