Skip to content

Commit

Permalink
Pass pruneblockchain RPC Results and Examples to RPCHelpMan
Browse files Browse the repository at this point in the history
Summary:
Accidentally skipped over this one when backporting the changes to the
other RPCs in `blockchain.cpp`.

Partial backport of Core [[bitcoin/bitcoin#14987 | PR14987]]

Test Plan:
On master:
  ninja
  ./bitcoind
  ./bitcoin-cli help > RPCs
  ./getrpchelps.sh RPCs master
Then on the patched branch:
  ninja
  ./bitcoind
  ./getrpchelps.sh RPCs patched
  ./checkrpc.sh RPCs master patched pruneblockchain.diff
Verify `pruneblockchain.diff` does not exist.

Scripts:
{F4258185}
{F4258184}

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, jasonbcox

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D5921
  • Loading branch information
Nico Guiton committed May 1, 2020
1 parent df9019c commit 69f5edb
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/rpc/blockchain.cpp
Expand Up @@ -1117,24 +1117,22 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats) {
static UniValue pruneblockchain(const Config &config,
const JSONRPCRequest &request) {
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
RPCHelpMan{
"pruneblockchain",
"",
{
{"height", RPCArg::Type::NUM, /* opt */ false,
/* default_val */ "",
"The block height to prune up to. May be set to a "
"discrete height, or a unix timestamp\n"
" to prune blocks whose block time is at "
"least 2 hours older than the provided timestamp."},
}}
.ToString() +
"\nResult:\n"
"n (numeric) Height of the last block pruned.\n"
"\nExamples:\n" +
HelpExampleCli("pruneblockchain", "1000") +
HelpExampleRpc("pruneblockchain", "1000"));
throw std::runtime_error(RPCHelpMan{
"pruneblockchain",
"",
{
{"height", RPCArg::Type::NUM, /* opt */ false,
/* default_val */ "",
"The block height to prune up to. May be set to a discrete "
"height, or a unix timestamp\n"
" to prune blocks whose block time is at "
"least 2 hours older than the provided timestamp."},
},
RPCResult{"n (numeric) Height of the last block pruned.\n"},
RPCExamples{HelpExampleCli("pruneblockchain", "1000") +
HelpExampleRpc("pruneblockchain", "1000")},
}
.ToStringWithResultsAndExamples());
}

if (!fPruneMode) {
Expand Down

0 comments on commit 69f5edb

Please sign in to comment.