From 69f5edb690719db3d5df43f8120ed1b35a4f64a2 Mon Sep 17 00:00:00 2001 From: Nico Guiton Date: Thu, 30 Apr 2020 21:14:02 +0000 Subject: [PATCH] Pass pruneblockchain RPC Results and Examples to RPCHelpMan Summary: Accidentally skipped over this one when backporting the changes to the other RPCs in `blockchain.cpp`. Partial backport of Core [[https://github.com/bitcoin/bitcoin/pull/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 --- src/rpc/blockchain.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 23e2d38277..2f51a241eb 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -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) {