diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp index 18f4fc1eef5..40aa1edaea8 100644 --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -16,9 +16,9 @@ #include #include -static RPCHelpMan rpcNestedTest_rpc() +static RPCMethod rpcNestedTest_rpc() { - return RPCHelpMan{ + return RPCMethod{ "rpcNestedTest", "echo the passed string(s)", { @@ -28,7 +28,7 @@ static RPCHelpMan rpcNestedTest_rpc() }, RPCResult{RPCResult::Type::ANY, "", ""}, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { return request.params.write(0, 0); }, }; diff --git a/src/rest.cpp b/src/rest.cpp index 899f0875e7c..53dd3d16119 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -711,7 +711,7 @@ static bool rest_block_filter(const std::any& context, HTTPRequest* req, const s } // A bit of a hack - dependency on a function defined in rpc/blockchain.cpp -RPCHelpMan getblockchaininfo(); +RPCMethod getblockchaininfo(); static bool rest_chaininfo(const std::any& context, HTTPRequest* req, const std::string& uri_part) { @@ -738,7 +738,7 @@ static bool rest_chaininfo(const std::any& context, HTTPRequest* req, const std: } -RPCHelpMan getdeploymentinfo(); +RPCMethod getdeploymentinfo(); static bool rest_deploymentinfo(const std::any& context, HTTPRequest* req, const std::string& str_uri_part) { diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 5d386c510ca..9b7e965ec31 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -244,9 +244,9 @@ UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIn return result; } -static RPCHelpMan getblockcount() +static RPCMethod getblockcount() { - return RPCHelpMan{ + return RPCMethod{ "getblockcount", "Returns the height of the most-work fully-validated chain.\n" "The genesis block has height 0.\n", @@ -257,7 +257,7 @@ static RPCHelpMan getblockcount() HelpExampleCli("getblockcount", "") + HelpExampleRpc("getblockcount", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -266,9 +266,9 @@ static RPCHelpMan getblockcount() }; } -static RPCHelpMan getbestblockhash() +static RPCMethod getbestblockhash() { - return RPCHelpMan{ + return RPCMethod{ "getbestblockhash", "Returns the hash of the best (tip) block in the most-work fully-validated chain.\n", {}, @@ -278,7 +278,7 @@ static RPCHelpMan getbestblockhash() HelpExampleCli("getbestblockhash", "") + HelpExampleRpc("getbestblockhash", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -287,9 +287,9 @@ static RPCHelpMan getbestblockhash() }; } -static RPCHelpMan waitfornewblock() +static RPCMethod waitfornewblock() { - return RPCHelpMan{ + return RPCMethod{ "waitfornewblock", "Waits for any new block and returns useful info about it.\n" "\nReturns the current block on timeout or exit.\n" @@ -308,7 +308,7 @@ static RPCHelpMan waitfornewblock() HelpExampleCli("waitfornewblock", "1000") + HelpExampleRpc("waitfornewblock", "1000") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int timeout = 0; if (!request.params[0].isNull()) @@ -346,9 +346,9 @@ static RPCHelpMan waitfornewblock() }; } -static RPCHelpMan waitforblock() +static RPCMethod waitforblock() { - return RPCHelpMan{ + return RPCMethod{ "waitforblock", "Waits for a specific new block and returns useful info about it.\n" "\nReturns the current block on timeout or exit.\n" @@ -367,7 +367,7 @@ static RPCHelpMan waitforblock() HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\" 1000") + HelpExampleRpc("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int timeout = 0; @@ -407,9 +407,9 @@ static RPCHelpMan waitforblock() }; } -static RPCHelpMan waitforblockheight() +static RPCMethod waitforblockheight() { - return RPCHelpMan{ + return RPCMethod{ "waitforblockheight", "Waits for (at least) block height and returns the height and hash\n" "of the current tip.\n" @@ -429,7 +429,7 @@ static RPCHelpMan waitforblockheight() HelpExampleCli("waitforblockheight", "100 1000") + HelpExampleRpc("waitforblockheight", "100, 1000") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int timeout = 0; @@ -470,9 +470,9 @@ static RPCHelpMan waitforblockheight() }; } -static RPCHelpMan syncwithvalidationinterfacequeue() +static RPCMethod syncwithvalidationinterfacequeue() { - return RPCHelpMan{ + return RPCMethod{ "syncwithvalidationinterfacequeue", "Waits for the validation interface queue to catch up on everything that was there when we entered this function.\n", {}, @@ -481,7 +481,7 @@ static RPCHelpMan syncwithvalidationinterfacequeue() HelpExampleCli("syncwithvalidationinterfacequeue","") + HelpExampleRpc("syncwithvalidationinterfacequeue","") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CHECK_NONFATAL(node.validation_signals)->SyncWithValidationInterfaceQueue(); @@ -490,9 +490,9 @@ static RPCHelpMan syncwithvalidationinterfacequeue() }; } -static RPCHelpMan getdifficulty() +static RPCMethod getdifficulty() { - return RPCHelpMan{ + return RPCMethod{ "getdifficulty", "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.\n", {}, @@ -502,7 +502,7 @@ static RPCHelpMan getdifficulty() HelpExampleCli("getdifficulty", "") + HelpExampleRpc("getdifficulty", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -511,9 +511,9 @@ static RPCHelpMan getdifficulty() }; } -static RPCHelpMan getblockfrompeer() +static RPCMethod getblockfrompeer() { - return RPCHelpMan{ + return RPCMethod{ "getblockfrompeer", "Attempt to fetch block from a given peer.\n\n" "We must have the header for this block, e.g. using submitheader.\n" @@ -532,7 +532,7 @@ static RPCHelpMan getblockfrompeer() HelpExampleCli("getblockfrompeer", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 0") + HelpExampleRpc("getblockfrompeer", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 0") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -566,9 +566,9 @@ static RPCHelpMan getblockfrompeer() }; } -static RPCHelpMan getblockhash() +static RPCMethod getblockhash() { - return RPCHelpMan{ + return RPCMethod{ "getblockhash", "Returns hash of block in best-block-chain at height provided.\n", { @@ -580,7 +580,7 @@ static RPCHelpMan getblockhash() HelpExampleCli("getblockhash", "1000") + HelpExampleRpc("getblockhash", "1000") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -596,9 +596,9 @@ static RPCHelpMan getblockhash() }; } -static RPCHelpMan getblockheader() +static RPCMethod getblockheader() { - return RPCHelpMan{ + return RPCMethod{ "getblockheader", "If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n" "If verbose is true, returns an Object with information about blockheader .\n", @@ -634,7 +634,7 @@ static RPCHelpMan getblockheader() HelpExampleCli("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + HelpExampleRpc("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash(ParseHashV(request.params[0], "hash")); @@ -758,9 +758,9 @@ const RPCResult getblock_vin{ } }; -static RPCHelpMan getblock() +static RPCMethod getblock() { - return RPCHelpMan{ + return RPCMethod{ "getblock", "If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n" "If verbosity is 1, returns an Object with information about block .\n" @@ -837,7 +837,7 @@ static RPCHelpMan getblock() HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash(ParseHashV(request.params[0], "blockhash")); @@ -905,9 +905,9 @@ std::optional GetPruneHeight(const BlockManager& blockman, const CChain& ch return CHECK_NONFATAL(first_unpruned.pprev)->nHeight; } -static RPCHelpMan pruneblockchain() +static RPCMethod pruneblockchain() { - return RPCHelpMan{"pruneblockchain", + return RPCMethod{"pruneblockchain", "Attempts to delete block and undo data up to a specified height or timestamp, if eligible for pruning.\n" "Requires `-prune` to be enabled at startup. While pruned data may be re-fetched in some cases (e.g., via `getblockfrompeer`), local deletion is irreversible.\n", { @@ -920,7 +920,7 @@ static RPCHelpMan pruneblockchain() HelpExampleCli("pruneblockchain", "1000") + HelpExampleRpc("pruneblockchain", "1000") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); if (!chainman.m_blockman.IsPruneMode()) { @@ -1007,9 +1007,9 @@ static std::optional GetUTXOStats(CCoinsView* view, node::B return kernel::ComputeUTXOStats(hash_type, view, blockman, interruption_point); } -static RPCHelpMan gettxoutsetinfo() +static RPCMethod gettxoutsetinfo() { - return RPCHelpMan{ + return RPCMethod{ "gettxoutsetinfo", "Returns statistics about the unspent transaction output set.\n" "Note this call may take some time if you are not using coinstatsindex.\n", @@ -1061,7 +1061,7 @@ static RPCHelpMan gettxoutsetinfo() HelpExampleRpc("gettxoutsetinfo", R"("none", 1000)") + HelpExampleRpc("gettxoutsetinfo", R"("none", "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09")") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue ret(UniValue::VOBJ); @@ -1179,9 +1179,9 @@ static RPCHelpMan gettxoutsetinfo() }; } -static RPCHelpMan gettxout() +static RPCMethod gettxout() { - return RPCHelpMan{ + return RPCMethod{ "gettxout", "Returns details about an unspent transaction output.\n", { @@ -1213,7 +1213,7 @@ static RPCHelpMan gettxout() "\nAs a JSON-RPC call\n" + HelpExampleRpc("gettxout", "\"txid\", 1") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -1259,9 +1259,9 @@ static RPCHelpMan gettxout() }; } -static RPCHelpMan verifychain() +static RPCMethod verifychain() { - return RPCHelpMan{ + return RPCMethod{ "verifychain", "Verifies blockchain database.\n", { @@ -1275,7 +1275,7 @@ static RPCHelpMan verifychain() HelpExampleCli("verifychain", "") + HelpExampleRpc("verifychain", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const int check_level{request.params[0].isNull() ? DEFAULT_CHECKLEVEL : request.params[0].getInt()}; const int check_depth{request.params[1].isNull() ? DEFAULT_CHECKBLOCKS : request.params[1].getInt()}; @@ -1361,9 +1361,9 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo } // used by rest.cpp:rest_chaininfo, so cannot be static -RPCHelpMan getblockchaininfo() +RPCMethod getblockchaininfo() { - return RPCHelpMan{"getblockchaininfo", + return RPCMethod{"getblockchaininfo", "Returns an object containing various state info regarding blockchain processing.\n", {}, RPCResult{ @@ -1409,7 +1409,7 @@ RPCHelpMan getblockchaininfo() HelpExampleCli("getblockchaininfo", "") + HelpExampleRpc("getblockchaininfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -1507,9 +1507,9 @@ UniValue DeploymentInfo(const CBlockIndex* blockindex, const ChainstateManager& } } // anon namespace -RPCHelpMan getdeploymentinfo() +RPCMethod getdeploymentinfo() { - return RPCHelpMan{"getdeploymentinfo", + return RPCMethod{"getdeploymentinfo", "Returns an object containing various state info regarding deployments of consensus changes.\n" "Consensus changes for which the new rules are enforced from genesis are not listed in \"deployments\".", { @@ -1528,7 +1528,7 @@ RPCHelpMan getdeploymentinfo() } }, RPCExamples{ HelpExampleCli("getdeploymentinfo", "") + HelpExampleRpc("getdeploymentinfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -1575,9 +1575,9 @@ struct CompareBlocksByHeight } }; -static RPCHelpMan getchaintips() +static RPCMethod getchaintips() { - return RPCHelpMan{"getchaintips", + return RPCMethod{"getchaintips", "Return information about all known tips in the block tree," " including the main chain as well as orphaned branches.\n", {}, @@ -1600,7 +1600,7 @@ static RPCHelpMan getchaintips() HelpExampleCli("getchaintips", "") + HelpExampleRpc("getchaintips", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -1673,9 +1673,9 @@ static RPCHelpMan getchaintips() }; } -static RPCHelpMan preciousblock() +static RPCMethod preciousblock() { - return RPCHelpMan{ + return RPCMethod{ "preciousblock", "Treats a block as if it were received before others with the same work.\n" "\nA later preciousblock call can override the effect of an earlier one.\n" @@ -1688,7 +1688,7 @@ static RPCHelpMan preciousblock() HelpExampleCli("preciousblock", "\"blockhash\"") + HelpExampleRpc("preciousblock", "\"blockhash\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash(ParseHashV(request.params[0], "blockhash")); CBlockIndex* pblockindex; @@ -1735,9 +1735,9 @@ void InvalidateBlock(ChainstateManager& chainman, const uint256 block_hash) { } } -static RPCHelpMan invalidateblock() +static RPCMethod invalidateblock() { - return RPCHelpMan{ + return RPCMethod{ "invalidateblock", "Permanently marks a block as invalid, as if it violated a consensus rule.\n", { @@ -1748,7 +1748,7 @@ static RPCHelpMan invalidateblock() HelpExampleCli("invalidateblock", "\"blockhash\"") + HelpExampleRpc("invalidateblock", "\"blockhash\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); uint256 hash(ParseHashV(request.params[0], "blockhash")); @@ -1780,9 +1780,9 @@ void ReconsiderBlock(ChainstateManager& chainman, uint256 block_hash) { } } -static RPCHelpMan reconsiderblock() +static RPCMethod reconsiderblock() { - return RPCHelpMan{ + return RPCMethod{ "reconsiderblock", "Removes invalidity status of a block, its ancestors and its descendants, reconsider them for activation.\n" "This can be used to undo the effects of invalidateblock.\n", @@ -1794,7 +1794,7 @@ static RPCHelpMan reconsiderblock() HelpExampleCli("reconsiderblock", "\"blockhash\"") + HelpExampleRpc("reconsiderblock", "\"blockhash\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); uint256 hash(ParseHashV(request.params[0], "blockhash")); @@ -1806,9 +1806,9 @@ static RPCHelpMan reconsiderblock() }; } -static RPCHelpMan getchaintxstats() +static RPCMethod getchaintxstats() { - return RPCHelpMan{ + return RPCMethod{ "getchaintxstats", "Compute statistics about the total number and rate of transactions in the chain.\n", { @@ -1837,7 +1837,7 @@ static RPCHelpMan getchaintxstats() HelpExampleCli("getchaintxstats", "") + HelpExampleRpc("getchaintxstats", "2016") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); const CBlockIndex* pindex; @@ -1953,9 +1953,9 @@ static inline bool SetHasKeys(const std::set& set, const Tk& key, const Args& // outpoint (needed for the utxo index) + nHeight + fCoinBase static constexpr size_t PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool); -static RPCHelpMan getblockstats() +static RPCMethod getblockstats() { - return RPCHelpMan{ + return RPCMethod{ "getblockstats", "Compute per block statistics for a given window. All amounts are in satoshis.\n" "It won't work for some heights with pruning.\n", @@ -2020,7 +2020,7 @@ static RPCHelpMan getblockstats() HelpExampleRpc("getblockstats", R"("00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09", ["minfeerate","avgfeerate"])") + HelpExampleRpc("getblockstats", R"(1000, ["minfeerate","avgfeerate"])") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); const CBlockIndex& pindex{*CHECK_NONFATAL(ParseHashOrHeight(request.params[0], chainman))}; @@ -2313,12 +2313,12 @@ static const auto scan_result_status_some = RPCResult{ }; -static RPCHelpMan scantxoutset() +static RPCMethod scantxoutset() { // raw() descriptor corresponding to mainnet address 12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S const std::string EXAMPLE_DESCRIPTOR_RAW = "raw(76a91411b366edfc0a8b66feebae5c2e25a7b6a5d1cf3188ac)#fm24fxxy"; - return RPCHelpMan{ + return RPCMethod{ "scantxoutset", "Scans the unspent transaction output set for entries that match certain output descriptors.\n" "Examples of output descriptors are:\n" @@ -2375,7 +2375,7 @@ static RPCHelpMan scantxoutset() HelpExampleRpc("scantxoutset", "\"status\"") + HelpExampleRpc("scantxoutset", "\"abort\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue result(UniValue::VOBJ); const auto action{self.Arg("action")}; @@ -2528,9 +2528,9 @@ static bool CheckBlockFilterMatches(BlockManager& blockman, const CBlockIndex& b return false; } -static RPCHelpMan scanblocks() +static RPCMethod scanblocks() { - return RPCHelpMan{ + return RPCMethod{ "scanblocks", "Return relevant blockhashes for given descriptors (requires blockfilterindex).\n" "This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)", @@ -2571,7 +2571,7 @@ static RPCHelpMan scanblocks() HelpExampleRpc("scanblocks", "\"start\", [\"addr(bcrt1q4u4nsgk6ug0sqz7r3rj9tykjxrsl0yy4d0wwte)\"], 100, 150, \"basic\"") + HelpExampleRpc("scanblocks", "\"status\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue ret(UniValue::VOBJ); auto action{self.Arg("action")}; @@ -2717,9 +2717,9 @@ static RPCHelpMan scanblocks() }; } -static RPCHelpMan getdescriptoractivity() +static RPCMethod getdescriptoractivity() { - return RPCHelpMan{ + return RPCMethod{ "getdescriptoractivity", "Get spend and receive activity associated with a set of descriptors for a set of blocks. " "This command pairs well with the `relevant_blocks` output of `scanblocks()`.\n" @@ -2767,7 +2767,7 @@ static RPCHelpMan getdescriptoractivity() RPCExamples{ HelpExampleCli("getdescriptoractivity", "'[\"000000000000000000001347062c12fded7c528943c8ce133987e2e2f5a840ee\"]' '[\"addr(bc1qzl6nsgqzu89a66l50cvwapnkw5shh23zarqkw9)\"]'") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue ret(UniValue::VOBJ); UniValue activity(UniValue::VARR); @@ -2953,9 +2953,9 @@ static RPCHelpMan getdescriptoractivity() }; } -static RPCHelpMan getblockfilter() +static RPCMethod getblockfilter() { - return RPCHelpMan{ + return RPCMethod{ "getblockfilter", "Retrieve a BIP 157 content filter for a particular block.\n", { @@ -2972,7 +2972,7 @@ static RPCHelpMan getblockfilter() HelpExampleCli("getblockfilter", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" \"basic\"") + HelpExampleRpc("getblockfilter", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\", \"basic\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 block_hash = ParseHashV(request.params[0], "blockhash"); auto filtertype_name{self.Arg("filtertype")}; @@ -3071,9 +3071,9 @@ public: * * @see SnapshotMetadata */ -static RPCHelpMan dumptxoutset() +static RPCMethod dumptxoutset() { - return RPCHelpMan{ + return RPCMethod{ "dumptxoutset", "Write the serialized UTXO set to a file. This can be used in loadtxoutset afterwards if this snapshot height is supported in the chainparams as well.\n\n" "Unless the \"latest\" type is requested, the node will roll back to the requested height and network activity will be suspended during this process. " @@ -3106,7 +3106,7 @@ static RPCHelpMan dumptxoutset() HelpExampleCli("-rpcclienttimeout=0 dumptxoutset", "utxo.dat rollback") + HelpExampleCli("-rpcclienttimeout=0 -named dumptxoutset", R"(utxo.dat rollback=853456)") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CBlockIndex* tip{WITH_LOCK(::cs_main, return node.chainman->ActiveChain().Tip())}; @@ -3365,9 +3365,9 @@ UniValue CreateUTXOSnapshot( node.rpc_interruption_point); } -static RPCHelpMan loadtxoutset() +static RPCMethod loadtxoutset() { - return RPCHelpMan{ + return RPCMethod{ "loadtxoutset", "Load the serialized UTXO set from a file.\n" "Once this snapshot is loaded, its contents will be " @@ -3401,7 +3401,7 @@ static RPCHelpMan loadtxoutset() RPCExamples{ HelpExampleCli("-rpcclienttimeout=0 loadtxoutset", "utxo.dat") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -3459,9 +3459,9 @@ const std::vector RPCHelpForChainstate{ {RPCResult::Type::BOOL, "validated", "whether the chainstate is fully validated. True if all blocks in the chainstate were validated, false if the chain is based on a snapshot and the snapshot has not yet been validated."}, }; -static RPCHelpMan getchainstates() +static RPCMethod getchainstates() { -return RPCHelpMan{ +return RPCMethod{ "getchainstates", "Return information about chainstates.\n", {}, @@ -3475,7 +3475,7 @@ return RPCHelpMan{ HelpExampleCli("getchainstates", "") + HelpExampleRpc("getchainstates", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(cs_main); UniValue obj(UniValue::VOBJ); diff --git a/src/rpc/external_signer.cpp b/src/rpc/external_signer.cpp index d0fad1231bc..24c3f2f0c74 100644 --- a/src/rpc/external_signer.cpp +++ b/src/rpc/external_signer.cpp @@ -17,9 +17,9 @@ #ifdef ENABLE_EXTERNAL_SIGNER -static RPCHelpMan enumeratesigners() +static RPCMethod enumeratesigners() { - return RPCHelpMan{"enumeratesigners", + return RPCMethod{"enumeratesigners", "Returns a list of external signers from -signer.", {}, RPCResult{ @@ -40,7 +40,7 @@ static RPCHelpMan enumeratesigners() HelpExampleCli("enumeratesigners", "") + HelpExampleRpc("enumeratesigners", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::string command = gArgs.GetArg("-signer", ""); if (command == "") throw JSONRPCError(RPC_MISC_ERROR, "Error: restart bitcoind with -signer="); diff --git a/src/rpc/fees.cpp b/src/rpc/fees.cpp index 9bad6f4a597..93017a8a9cc 100644 --- a/src/rpc/fees.cpp +++ b/src/rpc/fees.cpp @@ -29,9 +29,9 @@ using common::FeeModesDetail; using common::InvalidEstimateModeErrorMessage; using node::NodeContext; -static RPCHelpMan estimatesmartfee() +static RPCMethod estimatesmartfee() { - return RPCHelpMan{ + return RPCMethod{ "estimatesmartfee", "Estimates the approximate fee per kilobyte needed for a transaction to begin\n" "confirmation within conf_target blocks if possible and return the number of blocks\n" @@ -60,7 +60,7 @@ static RPCHelpMan estimatesmartfee() HelpExampleCli("estimatesmartfee", "6") + HelpExampleRpc("estimatesmartfee", "6") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context); const NodeContext& node = EnsureAnyNodeContext(request.context); @@ -94,9 +94,9 @@ static RPCHelpMan estimatesmartfee() }; } -static RPCHelpMan estimaterawfee() +static RPCMethod estimaterawfee() { - return RPCHelpMan{ + return RPCMethod{ "estimaterawfee", "WARNING: This interface is unstable and may disappear or change!\n" "\nWARNING: This is an advanced API call that is tightly coupled to the specific\n" @@ -149,7 +149,7 @@ static RPCHelpMan estimaterawfee() RPCExamples{ HelpExampleCli("estimaterawfee", "6 0.9") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context); const NodeContext& node = EnsureAnyNodeContext(request.context); diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index 1a94d10bf9f..f1efb26c404 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -44,9 +44,9 @@ using node::NodeContext; using node::TransactionError; using util::ToString; -static RPCHelpMan sendrawtransaction() +static RPCMethod sendrawtransaction() { - return RPCHelpMan{ + return RPCMethod{ "sendrawtransaction", "Submit a raw transaction (serialized, hex-encoded) to the network.\n" @@ -87,7 +87,7 @@ static RPCHelpMan sendrawtransaction() "\nAs a JSON-RPC call\n" + HelpExampleRpc("sendrawtransaction", "\"signedhex\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const CAmount max_burn_amount = request.params[2].isNull() ? 0 : AmountFromValue(request.params[2]); @@ -139,9 +139,9 @@ static RPCHelpMan sendrawtransaction() }; } -static RPCHelpMan getprivatebroadcastinfo() +static RPCMethod getprivatebroadcastinfo() { - return RPCHelpMan{ + return RPCMethod{ "getprivatebroadcastinfo", "Returns information about transactions that are currently being privately broadcast.\n", {}, @@ -171,7 +171,7 @@ static RPCHelpMan getprivatebroadcastinfo() HelpExampleCli("getprivatebroadcastinfo", "") + HelpExampleRpc("getprivatebroadcastinfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node{EnsureAnyNodeContext(request.context)}; const PeerManager& peerman{EnsurePeerman(node)}; @@ -204,9 +204,9 @@ static RPCHelpMan getprivatebroadcastinfo() }; } -static RPCHelpMan abortprivatebroadcast() +static RPCMethod abortprivatebroadcast() { - return RPCHelpMan{ + return RPCMethod{ "abortprivatebroadcast", "Abort private broadcast attempts for a transaction currently being privately broadcast.\n" "The transaction will be removed from the private broadcast queue.\n", @@ -232,7 +232,7 @@ static RPCHelpMan abortprivatebroadcast() HelpExampleCli("abortprivatebroadcast", "\"id\"") + HelpExampleRpc("abortprivatebroadcast", "\"id\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const uint256 id{ParseHashV(self.Arg("id"), "id")}; @@ -259,9 +259,9 @@ static RPCHelpMan abortprivatebroadcast() }; } -static RPCHelpMan testmempoolaccept() +static RPCMethod testmempoolaccept() { - return RPCHelpMan{ + return RPCMethod{ "testmempoolaccept", "Returns result of mempool acceptance tests indicating if raw transaction(s) (serialized, hex-encoded) would be accepted by mempool.\n" "\nIf multiple transactions are passed in, parents must come before children and package policies apply: the transactions cannot conflict with any mempool transactions or each other.\n" @@ -315,7 +315,7 @@ static RPCHelpMan testmempoolaccept() "\nAs a JSON-RPC call\n" + HelpExampleRpc("testmempoolaccept", "[\"signedhex\"]") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const UniValue raw_transactions = request.params[0].get_array(); if (raw_transactions.size() < 1 || raw_transactions.size() > MAX_PACKAGE_COUNT) { @@ -606,9 +606,9 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose, bool include_mempoo } } -static RPCHelpMan getmempoolfeeratediagram() +static RPCMethod getmempoolfeeratediagram() { - return RPCHelpMan{"getmempoolfeeratediagram", + return RPCMethod{"getmempoolfeeratediagram", "Returns the feerate diagram for the whole mempool.", {}, { @@ -629,7 +629,7 @@ static RPCHelpMan getmempoolfeeratediagram() HelpExampleCli("getmempoolfeeratediagram", "") + HelpExampleRpc("getmempoolfeeratediagram", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const CTxMemPool& mempool = EnsureAnyMemPool(request.context); LOCK(mempool.cs); @@ -649,9 +649,9 @@ static RPCHelpMan getmempoolfeeratediagram() }; } -static RPCHelpMan getrawmempool() +static RPCMethod getrawmempool() { - return RPCHelpMan{ + return RPCMethod{ "getrawmempool", "Returns all transaction ids in memory pool as a json array of string transaction ids.\n" "\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n", @@ -684,7 +684,7 @@ static RPCHelpMan getrawmempool() HelpExampleCli("getrawmempool", "true") + HelpExampleRpc("getrawmempool", "true") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { bool fVerbose = false; if (!request.params[0].isNull()) @@ -700,9 +700,9 @@ static RPCHelpMan getrawmempool() }; } -static RPCHelpMan getmempoolancestors() +static RPCMethod getmempoolancestors() { - return RPCHelpMan{ + return RPCMethod{ "getmempoolancestors", "If txid is in the mempool, returns all in-mempool ancestors.\n", { @@ -723,7 +723,7 @@ static RPCHelpMan getmempoolancestors() HelpExampleCli("getmempoolancestors", "\"mytxid\"") + HelpExampleRpc("getmempoolancestors", "\"mytxid\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { bool fVerbose = false; if (!request.params[1].isNull()) @@ -761,9 +761,9 @@ static RPCHelpMan getmempoolancestors() }; } -static RPCHelpMan getmempooldescendants() +static RPCMethod getmempooldescendants() { - return RPCHelpMan{ + return RPCMethod{ "getmempooldescendants", "If txid is in the mempool, returns all in-mempool descendants.\n", { @@ -784,7 +784,7 @@ static RPCHelpMan getmempooldescendants() HelpExampleCli("getmempooldescendants", "\"mytxid\"") + HelpExampleRpc("getmempooldescendants", "\"mytxid\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { bool fVerbose = false; if (!request.params[1].isNull()) @@ -826,9 +826,9 @@ static RPCHelpMan getmempooldescendants() }; } -static RPCHelpMan getmempoolcluster() +static RPCMethod getmempoolcluster() { - return RPCHelpMan{"getmempoolcluster", + return RPCMethod{"getmempoolcluster", "Returns mempool data for given cluster\n", { {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The txid of a transaction in the cluster"}, @@ -839,7 +839,7 @@ static RPCHelpMan getmempoolcluster() HelpExampleCli("getmempoolcluster", "txid") + HelpExampleRpc("getmempoolcluster", "txid") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash = ParseHashV(request.params[0], "txid"); @@ -861,9 +861,9 @@ static RPCHelpMan getmempoolcluster() }; } -static RPCHelpMan getmempoolentry() +static RPCMethod getmempoolentry() { - return RPCHelpMan{ + return RPCMethod{ "getmempoolentry", "Returns mempool data for given transaction\n", { @@ -875,7 +875,7 @@ static RPCHelpMan getmempoolentry() HelpExampleCli("getmempoolentry", "\"mytxid\"") + HelpExampleRpc("getmempoolentry", "\"mytxid\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { auto txid{Txid::FromUint256(ParseHashV(request.params[0], "txid"))}; @@ -894,9 +894,9 @@ static RPCHelpMan getmempoolentry() }; } -static RPCHelpMan gettxspendingprevout() +static RPCMethod gettxspendingprevout() { - return RPCHelpMan{"gettxspendingprevout", + return RPCMethod{"gettxspendingprevout", "Scans the mempool (and the txospenderindex, if available) to find transactions spending any of the given outputs", { {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The transaction outputs that we want to check, and within each, the txid (string) vout (numeric).", @@ -934,7 +934,7 @@ static RPCHelpMan gettxspendingprevout() + HelpExampleRpc("gettxspendingprevout", "\"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":3}]\"") + HelpExampleCliNamed("gettxspendingprevout", {{"outputs", "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":3}]"}, {"return_spending_tx", true}}) }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const UniValue& output_params = request.params[0].get_array(); if (output_params.empty()) { @@ -1064,9 +1064,9 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool) return ret; } -static RPCHelpMan getmempoolinfo() +static RPCMethod getmempoolinfo() { - return RPCHelpMan{"getmempoolinfo", + return RPCMethod{"getmempoolinfo", "Returns details on the active state of the TX memory pool.", {}, RPCResult{ @@ -1093,16 +1093,16 @@ static RPCHelpMan getmempoolinfo() HelpExampleCli("getmempoolinfo", "") + HelpExampleRpc("getmempoolinfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { return MempoolInfoToJSON(EnsureAnyMemPool(request.context)); }, }; } -static RPCHelpMan importmempool() +static RPCMethod importmempool() { - return RPCHelpMan{ + return RPCMethod{ "importmempool", "Import a mempool.dat file and attempt to add its contents to the mempool.\n" "Warning: Importing untrusted files is dangerous, especially if metadata from the file is taken over.", @@ -1130,7 +1130,7 @@ static RPCHelpMan importmempool() }, RPCResult{RPCResult::Type::OBJ, "", "", std::vector{}}, RPCExamples{HelpExampleCli("importmempool", "/path/to/mempool.dat") + HelpExampleRpc("importmempool", "/path/to/mempool.dat")}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node{EnsureAnyNodeContext(request.context)}; CTxMemPool& mempool{EnsureMemPool(node)}; @@ -1161,9 +1161,9 @@ static RPCHelpMan importmempool() }; } -static RPCHelpMan savemempool() +static RPCMethod savemempool() { - return RPCHelpMan{ + return RPCMethod{ "savemempool", "Dumps the mempool to disk. It will fail until the previous dump is fully loaded.\n", {}, @@ -1176,7 +1176,7 @@ static RPCHelpMan savemempool() HelpExampleCli("savemempool", "") + HelpExampleRpc("savemempool", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const ArgsManager& args{EnsureAnyArgsman(request.context)}; const CTxMemPool& mempool = EnsureAnyMemPool(request.context); @@ -1230,9 +1230,9 @@ static UniValue OrphanToJSON(const node::TxOrphanage::OrphanInfo& orphan) return o; } -static RPCHelpMan getorphantxs() +static RPCMethod getorphantxs() { - return RPCHelpMan{ + return RPCMethod{ "getorphantxs", "Shows transactions in the tx orphanage.\n" "\nEXPERIMENTAL warning: this call may be changed in future releases.\n", @@ -1266,7 +1266,7 @@ static RPCHelpMan getorphantxs() HelpExampleCli("getorphantxs", "2") + HelpExampleRpc("getorphantxs", "2") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node = EnsureAnyNodeContext(request.context); PeerManager& peerman = EnsurePeerman(node); @@ -1299,9 +1299,9 @@ static RPCHelpMan getorphantxs() }; } -static RPCHelpMan submitpackage() +static RPCMethod submitpackage() { - return RPCHelpMan{"submitpackage", + return RPCMethod{"submitpackage", "Submit a package of raw transactions (serialized, hex-encoded) to local node.\n" "The package will be validated according to consensus and mempool policy rules. If any transaction passes, it will be accepted to mempool.\n" "This RPC is experimental and the interface may be unstable. Refer to doc/policy/packages.md for documentation on package policies.\n" @@ -1355,7 +1355,7 @@ static RPCHelpMan submitpackage() HelpExampleRpc("submitpackage", R"(["raw-parent-tx-1", "raw-parent-tx-2", "raw-child-tx"])") + HelpExampleCli("submitpackage", R"('["raw-tx-without-unconfirmed-parents"]')") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const UniValue raw_transactions = request.params[0].get_array(); if (raw_transactions.empty() || raw_transactions.size() > MAX_PACKAGE_COUNT) { diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index a935810d914..f0d31ec0ef4 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -108,9 +108,9 @@ static UniValue GetNetworkHashPS(int lookup, int height, const CChain& active_ch return workDiff.getdouble() / timeDiff; } -static RPCHelpMan getnetworkhashps() +static RPCMethod getnetworkhashps() { - return RPCHelpMan{ + return RPCMethod{ "getnetworkhashps", "Returns the estimated network hashes per second based on the last n blocks.\n" "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n" @@ -125,7 +125,7 @@ static RPCHelpMan getnetworkhashps() HelpExampleCli("getnetworkhashps", "") + HelpExampleRpc("getnetworkhashps", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -216,9 +216,9 @@ static bool getScriptFromDescriptor(std::string_view descriptor, CScript& script return true; } -static RPCHelpMan generatetodescriptor() +static RPCMethod generatetodescriptor() { - return RPCHelpMan{ + return RPCMethod{ "generatetodescriptor", "Mine to a specified descriptor and return the block hashes.", { @@ -234,7 +234,7 @@ static RPCHelpMan generatetodescriptor() }, RPCExamples{ "\nGenerate 11 blocks to mydesc\n" + HelpExampleCli("generatetodescriptor", "11 \"mydesc\"")}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const auto num_blocks{self.Arg("num_blocks")}; const auto max_tries{self.Arg("maxtries")}; @@ -254,16 +254,16 @@ static RPCHelpMan generatetodescriptor() }; } -static RPCHelpMan generate() +static RPCMethod generate() { - return RPCHelpMan{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + return RPCMethod{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { throw JSONRPCError(RPC_METHOD_NOT_FOUND, self.ToString()); }}; } -static RPCHelpMan generatetoaddress() +static RPCMethod generatetoaddress() { - return RPCHelpMan{"generatetoaddress", + return RPCMethod{"generatetoaddress", "Mine to a specified address and return the block hashes.", { {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated."}, @@ -281,7 +281,7 @@ static RPCHelpMan generatetoaddress() + "If you are using the " CLIENT_NAME " wallet, you can get a new address to send the newly generated bitcoin to with:\n" + HelpExampleCli("getnewaddress", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const int num_blocks{request.params[0].getInt()}; const uint64_t max_tries{request.params[2].isNull() ? DEFAULT_MAX_TRIES : request.params[2].getInt()}; @@ -302,9 +302,9 @@ static RPCHelpMan generatetoaddress() }; } -static RPCHelpMan generateblock() +static RPCMethod generateblock() { - return RPCHelpMan{"generateblock", + return RPCMethod{"generateblock", "Mine a set of ordered transactions to a specified address or descriptor and return the block hash.\n" "Transaction fees are not collected in the block reward.", { @@ -329,7 +329,7 @@ static RPCHelpMan generateblock() "\nGenerate a block to myaddress, with txs rawtx and mempool_txid\n" + HelpExampleCli("generateblock", R"("myaddress" '["rawtx", "mempool_txid"]')") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const auto address_or_descriptor = request.params[0].get_str(); CScript coinbase_output_script; @@ -413,9 +413,9 @@ static RPCHelpMan generateblock() }; } -static RPCHelpMan getmininginfo() +static RPCMethod getmininginfo() { - return RPCHelpMan{ + return RPCMethod{ "getmininginfo", "Returns a json object containing mining-related information.", {}, @@ -453,7 +453,7 @@ static RPCHelpMan getmininginfo() HelpExampleCli("getmininginfo", "") + HelpExampleRpc("getmininginfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CTxMemPool& mempool = EnsureMemPool(node); @@ -499,9 +499,9 @@ static RPCHelpMan getmininginfo() // NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts -static RPCHelpMan prioritisetransaction() +static RPCMethod prioritisetransaction() { - return RPCHelpMan{"prioritisetransaction", + return RPCMethod{"prioritisetransaction", "Accepts the transaction into mined blocks at a higher (or lower) priority\n", { {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id."}, @@ -518,7 +518,7 @@ static RPCHelpMan prioritisetransaction() HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") + HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(cs_main); @@ -544,9 +544,9 @@ static RPCHelpMan prioritisetransaction() }; } -static RPCHelpMan getprioritisedtransactions() +static RPCMethod getprioritisedtransactions() { - return RPCHelpMan{"getprioritisedtransactions", + return RPCMethod{"getprioritisedtransactions", "Returns a map of all user-created (see prioritisetransaction) fee deltas by txid, and whether the tx is present in mempool.", {}, RPCResult{ @@ -563,7 +563,7 @@ static RPCHelpMan getprioritisedtransactions() HelpExampleCli("getprioritisedtransactions", "") + HelpExampleRpc("getprioritisedtransactions", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CTxMemPool& mempool = EnsureMemPool(node); @@ -612,9 +612,9 @@ static std::string gbt_rule_value(const std::string& name, bool gbt_optional_rul return s; } -static RPCHelpMan getblocktemplate() +static RPCMethod getblocktemplate() { - return RPCHelpMan{ + return RPCMethod{ "getblocktemplate", "If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n" "It returns data needed to construct a block to work on.\n" @@ -704,7 +704,7 @@ static RPCHelpMan getblocktemplate() HelpExampleCli("getblocktemplate", "'{\"rules\": [\"segwit\"]}'") + HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -1053,10 +1053,10 @@ protected: } }; -static RPCHelpMan submitblock() +static RPCMethod submitblock() { // We allow 2 arguments for compliance with BIP22. Argument 2 is ignored. - return RPCHelpMan{ + return RPCMethod{ "submitblock", "Attempts to submit new block to network.\n" "See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n", @@ -1072,7 +1072,7 @@ static RPCHelpMan submitblock() HelpExampleCli("submitblock", "\"mydata\"") + HelpExampleRpc("submitblock", "\"mydata\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr blockptr = std::make_shared(); CBlock& block = *blockptr; @@ -1105,9 +1105,9 @@ static RPCHelpMan submitblock() }; } -static RPCHelpMan submitheader() +static RPCMethod submitheader() { - return RPCHelpMan{ + return RPCMethod{ "submitheader", "Decode the given hexdata as a header and submit it as a candidate chain tip if valid." "\nThrows when the header is invalid.\n", @@ -1120,7 +1120,7 @@ static RPCHelpMan submitheader() HelpExampleCli("submitheader", "\"aabbcc\"") + HelpExampleRpc("submitheader", "\"aabbcc\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CBlockHeader h; if (!DecodeHexBlockHeader(h, request.params[0].get_str())) { diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index ea07c560cd6..06fc4cb18ce 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -58,9 +58,9 @@ const std::vector TRANSPORT_TYPE_DOC{ "v2 (BIP324 encrypted transport protocol)" }; -static RPCHelpMan getconnectioncount() +static RPCMethod getconnectioncount() { - return RPCHelpMan{ + return RPCMethod{ "getconnectioncount", "Returns the number of connections to other nodes.\n", {}, @@ -71,7 +71,7 @@ static RPCHelpMan getconnectioncount() HelpExampleCli("getconnectioncount", "") + HelpExampleRpc("getconnectioncount", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -81,9 +81,9 @@ static RPCHelpMan getconnectioncount() }; } -static RPCHelpMan ping() +static RPCMethod ping() { - return RPCHelpMan{ + return RPCMethod{ "ping", "Requests that a ping be sent to all other nodes, to measure ping time.\n" "Results are provided in getpeerinfo.\n" @@ -94,7 +94,7 @@ static RPCHelpMan ping() HelpExampleCli("ping", "") + HelpExampleRpc("ping", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); PeerManager& peerman = EnsurePeerman(node); @@ -118,9 +118,9 @@ static UniValue GetServicesNames(ServiceFlags services) return servicesNames; } -static RPCHelpMan getpeerinfo() +static RPCMethod getpeerinfo() { - return RPCHelpMan{ + return RPCMethod{ "getpeerinfo", "Returns data about each connected network peer as a json array of objects.", {}, @@ -201,7 +201,7 @@ static RPCHelpMan getpeerinfo() HelpExampleCli("getpeerinfo", "") + HelpExampleRpc("getpeerinfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -310,9 +310,9 @@ static RPCHelpMan getpeerinfo() }; } -static RPCHelpMan addnode() +static RPCMethod addnode() { - return RPCHelpMan{ + return RPCMethod{ "addnode", "Attempts to add or remove a node from the addnode list.\n" "Or try a connection to a node once.\n" @@ -330,7 +330,7 @@ static RPCHelpMan addnode() HelpExampleCli("addnode", "\"192.168.0.6:8333\" \"onetry\" true") + HelpExampleRpc("addnode", "\"192.168.0.6:8333\", \"onetry\" true") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const auto command{self.Arg("command")}; if (command != "onetry" && command != "add" && command != "remove") { @@ -374,9 +374,9 @@ static RPCHelpMan addnode() }; } -static RPCHelpMan addconnection() +static RPCMethod addconnection() { - return RPCHelpMan{ + return RPCMethod{ "addconnection", "Open an outbound connection to a specified node. This RPC is for testing only.\n", { @@ -394,7 +394,7 @@ static RPCHelpMan addconnection() HelpExampleCli("addconnection", "\"192.168.0.6:8333\" \"outbound-full-relay\" true") + HelpExampleRpc("addconnection", "\"192.168.0.6:8333\" \"outbound-full-relay\" true") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (Params().GetChainType() != ChainType::REGTEST) { throw std::runtime_error("addconnection is for regression testing (-regtest mode) only."); @@ -437,9 +437,9 @@ static RPCHelpMan addconnection() }; } -static RPCHelpMan disconnectnode() +static RPCMethod disconnectnode() { - return RPCHelpMan{ + return RPCMethod{ "disconnectnode", "Immediately disconnects from the specified peer node.\n" "\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n" @@ -455,7 +455,7 @@ static RPCHelpMan disconnectnode() + HelpExampleRpc("disconnectnode", "\"192.168.0.6:8333\"") + HelpExampleRpc("disconnectnode", "\"\", 1") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CConnman& connman = EnsureConnman(node); @@ -483,9 +483,9 @@ static RPCHelpMan disconnectnode() }; } -static RPCHelpMan getaddednodeinfo() +static RPCMethod getaddednodeinfo() { - return RPCHelpMan{ + return RPCMethod{ "getaddednodeinfo", "Returns information about the given added node, or all added nodes\n" "(note that onetry addnodes are not listed here)\n", @@ -514,7 +514,7 @@ static RPCHelpMan getaddednodeinfo() HelpExampleCli("getaddednodeinfo", "\"192.168.0.201\"") + HelpExampleRpc("getaddednodeinfo", "\"192.168.0.201\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -557,9 +557,9 @@ static RPCHelpMan getaddednodeinfo() }; } -static RPCHelpMan getnettotals() +static RPCMethod getnettotals() { - return RPCHelpMan{"getnettotals", + return RPCMethod{"getnettotals", "Returns information about network traffic, including bytes in, bytes out,\n" "and current system time.", {}, @@ -584,7 +584,7 @@ static RPCHelpMan getnettotals() HelpExampleCli("getnettotals", "") + HelpExampleRpc("getnettotals", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -626,9 +626,9 @@ static UniValue GetNetworksInfo() return networks; } -static RPCHelpMan getnetworkinfo() +static RPCMethod getnetworkinfo() { - return RPCHelpMan{"getnetworkinfo", + return RPCMethod{"getnetworkinfo", "Returns an object containing various state info regarding P2P networking.\n", {}, RPCResult{ @@ -684,7 +684,7 @@ static RPCHelpMan getnetworkinfo() HelpExampleCli("getnetworkinfo", "") + HelpExampleRpc("getnetworkinfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(cs_main); UniValue obj(UniValue::VOBJ); @@ -733,9 +733,9 @@ static RPCHelpMan getnetworkinfo() }; } -static RPCHelpMan setban() +static RPCMethod setban() { - return RPCHelpMan{ + return RPCMethod{ "setban", "Attempts to add or remove an IP/Subnet from the banned list.\n", { @@ -750,7 +750,7 @@ static RPCHelpMan setban() + HelpExampleCli("setban", "\"192.168.0.0/24\" \"add\"") + HelpExampleRpc("setban", "\"192.168.0.6\", \"add\", 86400") }, - [&](const RPCHelpMan& help, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& help, const JSONRPCRequest& request) -> UniValue { auto command{help.Arg("command")}; if (command != "add" && command != "remove") { @@ -813,9 +813,9 @@ static RPCHelpMan setban() }; } -static RPCHelpMan listbanned() +static RPCMethod listbanned() { - return RPCHelpMan{ + return RPCMethod{ "listbanned", "List all manually banned IPs/Subnets.\n", {}, @@ -834,7 +834,7 @@ static RPCHelpMan listbanned() HelpExampleCli("listbanned", "") + HelpExampleRpc("listbanned", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BanMan& banman = EnsureAnyBanman(request.context); @@ -861,9 +861,9 @@ static RPCHelpMan listbanned() }; } -static RPCHelpMan clearbanned() +static RPCMethod clearbanned() { - return RPCHelpMan{ + return RPCMethod{ "clearbanned", "Clear all banned IPs.\n", {}, @@ -872,7 +872,7 @@ static RPCHelpMan clearbanned() HelpExampleCli("clearbanned", "") + HelpExampleRpc("clearbanned", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BanMan& banman = EnsureAnyBanman(request.context); @@ -883,9 +883,9 @@ static RPCHelpMan clearbanned() }; } -static RPCHelpMan setnetworkactive() +static RPCMethod setnetworkactive() { - return RPCHelpMan{ + return RPCMethod{ "setnetworkactive", "Disable/enable all p2p network activity.\n", { @@ -893,7 +893,7 @@ static RPCHelpMan setnetworkactive() }, RPCResult{RPCResult::Type::BOOL, "", "The value that was passed in"}, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CConnman& connman = EnsureConnman(node); @@ -905,9 +905,9 @@ static RPCHelpMan setnetworkactive() }; } -static RPCHelpMan getnodeaddresses() +static RPCMethod getnodeaddresses() { - return RPCHelpMan{"getnodeaddresses", + return RPCMethod{"getnodeaddresses", "Return known addresses, after filtering for quality and recency.\n" "These can potentially be used to find new peers in the network.\n" "The total number of addresses known to the node may be higher.", @@ -935,7 +935,7 @@ static RPCHelpMan getnodeaddresses() + HelpExampleRpc("getnodeaddresses", "8") + HelpExampleRpc("getnodeaddresses", "4, \"i2p\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -966,9 +966,9 @@ static RPCHelpMan getnodeaddresses() }; } -static RPCHelpMan addpeeraddress() +static RPCMethod addpeeraddress() { - return RPCHelpMan{"addpeeraddress", + return RPCMethod{"addpeeraddress", "Add the address of a potential peer to an address manager table. This RPC is for testing only.", { {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The IP address of the peer"}, @@ -986,7 +986,7 @@ static RPCHelpMan addpeeraddress() HelpExampleCli("addpeeraddress", "\"1.2.3.4\" 8333 true") + HelpExampleRpc("addpeeraddress", "\"1.2.3.4\", 8333, true") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { AddrMan& addrman = EnsureAnyAddrman(request.context); @@ -1026,9 +1026,9 @@ static RPCHelpMan addpeeraddress() }; } -static RPCHelpMan sendmsgtopeer() +static RPCMethod sendmsgtopeer() { - return RPCHelpMan{ + return RPCMethod{ "sendmsgtopeer", "Send a p2p message to a peer specified by id.\n" "The message type and body must be provided, the message header will be generated.\n" @@ -1041,7 +1041,7 @@ static RPCHelpMan sendmsgtopeer() RPCResult{RPCResult::Type::OBJ, "", "", std::vector{}}, RPCExamples{ HelpExampleCli("sendmsgtopeer", "0 \"addr\" \"ffffff\"") + HelpExampleRpc("sendmsgtopeer", "0 \"addr\" \"ffffff\"")}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeId peer_id{request.params[0].getInt()}; const auto msg_type{self.Arg("msg_type")}; if (msg_type.size() > CMessageHeader::MESSAGE_TYPE_SIZE) { @@ -1074,9 +1074,9 @@ static RPCHelpMan sendmsgtopeer() }; } -static RPCHelpMan getaddrmaninfo() +static RPCMethod getaddrmaninfo() { - return RPCHelpMan{ + return RPCMethod{ "getaddrmaninfo", "Provides information about the node's address manager by returning the number of " "addresses in the `new` and `tried` tables and their sum for all networks.\n", @@ -1090,7 +1090,7 @@ static RPCHelpMan getaddrmaninfo() }}, }}, RPCExamples{HelpExampleCli("getaddrmaninfo", "") + HelpExampleRpc("getaddrmaninfo", "")}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { AddrMan& addrman = EnsureAnyAddrman(request.context); UniValue ret(UniValue::VOBJ); @@ -1150,9 +1150,9 @@ UniValue AddrmanTableToJSON(const std::vector UniValue { + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { AddrMan& addrman = EnsureAnyAddrman(request.context); NodeContext& node_context = EnsureAnyNodeContext(request.context); CConnman& connman = EnsureConnman(node_context); diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp index 2379ae07e06..45b597fb118 100644 --- a/src/rpc/node.cpp +++ b/src/rpc/node.cpp @@ -36,9 +36,9 @@ using node::NodeContext; -static RPCHelpMan setmocktime() +static RPCMethod setmocktime() { - return RPCHelpMan{ + return RPCMethod{ "setmocktime", "Set the local time to given timestamp (-regtest only)\n", { @@ -47,7 +47,7 @@ static RPCHelpMan setmocktime() }, RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (!Params().IsMockableChain()) { throw std::runtime_error("setmocktime is for regression testing (-regtest mode) only"); @@ -77,9 +77,9 @@ static RPCHelpMan setmocktime() }; } -static RPCHelpMan mockscheduler() +static RPCMethod mockscheduler() { - return RPCHelpMan{ + return RPCMethod{ "mockscheduler", "Bump the scheduler into the future (-regtest only)\n", { @@ -87,7 +87,7 @@ static RPCHelpMan mockscheduler() }, RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (!Params().IsMockableChain()) { throw std::runtime_error("mockscheduler is for regression testing (-regtest mode) only"); @@ -142,12 +142,12 @@ static std::string RPCMallocInfo() } #endif -static RPCHelpMan getmemoryinfo() +static RPCMethod getmemoryinfo() { /* Please, avoid using the word "pool" here in the RPC interface or help, * as users will undoubtedly confuse it with the other "memory pool" */ - return RPCHelpMan{"getmemoryinfo", + return RPCMethod{"getmemoryinfo", "Returns an object containing information about memory usage.\n", { {"mode", RPCArg::Type::STR, RPCArg::Default{"stats"}, "determines what kind of information is returned.\n" @@ -177,7 +177,7 @@ static RPCHelpMan getmemoryinfo() HelpExampleCli("getmemoryinfo", "") + HelpExampleRpc("getmemoryinfo", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { auto mode{self.Arg("mode")}; if (mode == "stats") { @@ -215,9 +215,9 @@ static void EnableOrDisableLogCategories(UniValue cats, bool enable) { } } -static RPCHelpMan logging() +static RPCMethod logging() { - return RPCHelpMan{"logging", + return RPCMethod{"logging", "Gets and sets the logging configuration.\n" "When called without an argument, returns the list of categories with status that are currently being debug logged or not.\n" "When called with arguments, adds or removes categories from debug logging and return the lists above.\n" @@ -247,7 +247,7 @@ static RPCHelpMan logging() HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"") + HelpExampleRpc("logging", "[\"all\"], [\"libevent\"]") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BCLog::CategoryMask original_log_categories = LogInstance().GetCategoryMask(); if (request.params[0].isArray()) { @@ -274,9 +274,9 @@ static RPCHelpMan logging() }; } -static RPCHelpMan echo(const std::string& name) +static RPCMethod echo(const std::string& name) { - return RPCHelpMan{ + return RPCMethod{ name, "Simply echo back the input arguments. This command is for testing.\n" "\nIt will return an internal bug report when arg9='trigger_internal_bug' is passed.\n" @@ -296,7 +296,7 @@ static RPCHelpMan echo(const std::string& name) }, RPCResult{RPCResult::Type::ANY, "", "Returns whatever was passed in"}, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (request.params[9].isStr()) { CHECK_NONFATAL(request.params[9].get_str() != "trigger_internal_bug"); @@ -307,12 +307,12 @@ static RPCHelpMan echo(const std::string& name) }; } -static RPCHelpMan echo() { return echo("echo"); } -static RPCHelpMan echojson() { return echo("echojson"); } +static RPCMethod echo() { return echo("echo"); } +static RPCMethod echojson() { return echo("echojson"); } -static RPCHelpMan echoipc() +static RPCMethod echoipc() { - return RPCHelpMan{ + return RPCMethod{ "echoipc", "Echo back the input argument, passing it through a spawned process in a multiprocess build.\n" "This command is for testing.\n", @@ -320,7 +320,7 @@ static RPCHelpMan echoipc() RPCResult{RPCResult::Type::STR, "echo", "The echoed string."}, RPCExamples{HelpExampleCli("echo", "\"Hello world\"") + HelpExampleRpc("echo", "\"Hello world\"")}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { interfaces::Init& local_init = *EnsureAnyNodeContext(request.context).init; std::unique_ptr echo; if (interfaces::Ipc* ipc = local_init.ipc()) { @@ -360,9 +360,9 @@ static UniValue SummaryToJSON(const IndexSummary&& summary, std::string index_na return ret_summary; } -static RPCHelpMan getindexinfo() +static RPCMethod getindexinfo() { - return RPCHelpMan{ + return RPCMethod{ "getindexinfo", "Returns the status of one or all available indices currently running in the node.\n", { @@ -385,7 +385,7 @@ static RPCHelpMan getindexinfo() + HelpExampleCli("getindexinfo", "txindex") + HelpExampleRpc("getindexinfo", "txindex") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue result(UniValue::VOBJ); const std::string index_name{self.MaybeArg("index_name").value_or("")}; diff --git a/src/rpc/output_script.cpp b/src/rpc/output_script.cpp index 2d65b98a8c7..fb04589ff4b 100644 --- a/src/rpc/output_script.cpp +++ b/src/rpc/output_script.cpp @@ -26,9 +26,9 @@ #include #include -static RPCHelpMan validateaddress() +static RPCMethod validateaddress() { - return RPCHelpMan{ + return RPCMethod{ "validateaddress", "Return information about the given bitcoin address.\n", { @@ -55,7 +55,7 @@ static RPCHelpMan validateaddress() HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") + HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::string error_msg; std::vector error_locations; @@ -86,9 +86,9 @@ static RPCHelpMan validateaddress() }; } -static RPCHelpMan createmultisig() +static RPCMethod createmultisig() { - return RPCHelpMan{ + return RPCMethod{ "createmultisig", "Creates a multi-signature address with n signatures of m keys required.\n" "It returns a json object with the address and redeemScript.\n", @@ -118,7 +118,7 @@ static RPCHelpMan createmultisig() "\nAs a JSON-RPC call\n" + HelpExampleRpc("createmultisig", "2, [\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int required = request.params[0].getInt(); @@ -163,11 +163,11 @@ static RPCHelpMan createmultisig() }; } -static RPCHelpMan getdescriptorinfo() +static RPCMethod getdescriptorinfo() { const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)"; - return RPCHelpMan{ + return RPCMethod{ "getdescriptorinfo", "Analyses a descriptor.\n", { @@ -192,7 +192,7 @@ static RPCHelpMan getdescriptorinfo() HelpExampleCli("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"") + HelpExampleRpc("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { FlatSigningProvider provider; std::string error; @@ -255,11 +255,11 @@ static UniValue DeriveAddresses(const Descriptor* desc, int64_t range_begin, int return addresses; } -static RPCHelpMan deriveaddresses() +static RPCMethod deriveaddresses() { const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu"; - return RPCHelpMan{ + return RPCMethod{ "deriveaddresses", "Derives one or more addresses corresponding to an output descriptor.\n" "Examples of output descriptors are:\n" @@ -299,7 +299,7 @@ static RPCHelpMan deriveaddresses() HelpExampleCli("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\" \"[0,2]\"") + HelpExampleRpc("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\", \"[0,2]\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { auto desc_str{self.Arg("descriptor")}; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 7a202ccfcc3..cd0f3ea44b6 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -213,9 +213,9 @@ PartiallySignedTransaction ProcessPSBT(const std::string& psbt_string, const std return psbtx; } -static RPCHelpMan getrawtransaction() +static RPCMethod getrawtransaction() { - return RPCHelpMan{ + return RPCMethod{ "getrawtransaction", "By default, this call only returns a transaction if it is in the mempool. If -txindex is enabled\n" @@ -279,7 +279,7 @@ static RPCHelpMan getrawtransaction() + HelpExampleCli("getrawtransaction", "\"mytxid\" 1 \"myblockhash\"") + HelpExampleCli("getrawtransaction", "\"mytxid\" 2 \"myblockhash\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -374,9 +374,9 @@ static RPCHelpMan getrawtransaction() }; } -static RPCHelpMan createrawtransaction() +static RPCMethod createrawtransaction() { - return RPCHelpMan{ + return RPCMethod{ "createrawtransaction", "Create a transaction spending the given inputs and creating new outputs.\n" "Outputs can be addresses or data.\n" @@ -393,7 +393,7 @@ static RPCHelpMan createrawtransaction() + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"address\\\":0.01}]\"") + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"data\\\":\\\"00010203\\\"}]\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::optional rbf; if (!request.params[3].isNull()) { @@ -406,9 +406,9 @@ static RPCHelpMan createrawtransaction() }; } -static RPCHelpMan decoderawtransaction() +static RPCMethod decoderawtransaction() { - return RPCHelpMan{"decoderawtransaction", + return RPCMethod{"decoderawtransaction", "Return a JSON object representing the serialized, hex-encoded transaction.", { {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction hex string"}, @@ -428,7 +428,7 @@ static RPCHelpMan decoderawtransaction() HelpExampleCli("decoderawtransaction", "\"hexstring\"") + HelpExampleRpc("decoderawtransaction", "\"hexstring\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CMutableTransaction mtx; @@ -447,9 +447,9 @@ static RPCHelpMan decoderawtransaction() }; } -static RPCHelpMan decodescript() +static RPCMethod decodescript() { - return RPCHelpMan{ + return RPCMethod{ "decodescript", "Decode a hex-encoded script.\n", { @@ -480,7 +480,7 @@ static RPCHelpMan decodescript() HelpExampleCli("decodescript", "\"hexstring\"") + HelpExampleRpc("decodescript", "\"hexstring\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue r(UniValue::VOBJ); CScript script; @@ -582,9 +582,9 @@ static RPCHelpMan decodescript() }; } -static RPCHelpMan combinerawtransaction() +static RPCMethod combinerawtransaction() { - return RPCHelpMan{ + return RPCMethod{ "combinerawtransaction", "Combine multiple partially signed transactions into one transaction.\n" "The combined transaction may be another partially signed transaction or a \n" @@ -602,7 +602,7 @@ static RPCHelpMan combinerawtransaction() RPCExamples{ HelpExampleCli("combinerawtransaction", R"('["myhex1", "myhex2", "myhex3"]')") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue txs = request.params[0].get_array(); @@ -669,9 +669,9 @@ static RPCHelpMan combinerawtransaction() }; } -static RPCHelpMan signrawtransactionwithkey() +static RPCMethod signrawtransactionwithkey() { - return RPCHelpMan{ + return RPCMethod{ "signrawtransactionwithkey", "Sign inputs for raw transaction (serialized, hex-encoded).\n" "The second argument is an array of base58-encoded private\n" @@ -735,7 +735,7 @@ static RPCHelpMan signrawtransactionwithkey() HelpExampleCli("signrawtransactionwithkey", "\"myhex\" \"[\\\"key1\\\",\\\"key2\\\"]\"") + HelpExampleRpc("signrawtransactionwithkey", "\"myhex\", \"[\\\"key1\\\",\\\"key2\\\"]\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CMutableTransaction mtx; if (!DecodeHexTx(mtx, request.params[0].get_str())) { @@ -1010,9 +1010,9 @@ const RPCResult decodepsbt_outputs{ } }; -static RPCHelpMan decodepsbt() +static RPCMethod decodepsbt() { - return RPCHelpMan{ + return RPCMethod{ "decodepsbt", "Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.", { @@ -1056,7 +1056,7 @@ static RPCHelpMan decodepsbt() RPCExamples{ HelpExampleCli("decodepsbt", "\"psbt\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions PartiallySignedTransaction psbtx; @@ -1512,9 +1512,9 @@ static RPCHelpMan decodepsbt() }; } -static RPCHelpMan combinepsbt() +static RPCMethod combinepsbt() { - return RPCHelpMan{ + return RPCMethod{ "combinepsbt", "Combine multiple partially signed Bitcoin transactions into one transaction.\n" "Implements the Combiner role.\n", @@ -1531,7 +1531,7 @@ static RPCHelpMan combinepsbt() RPCExamples{ HelpExampleCli("combinepsbt", R"('["mybase64_1", "mybase64_2", "mybase64_3"]')") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions std::vector psbtxs; @@ -1560,9 +1560,9 @@ static RPCHelpMan combinepsbt() }; } -static RPCHelpMan finalizepsbt() +static RPCMethod finalizepsbt() { - return RPCHelpMan{"finalizepsbt", + return RPCMethod{"finalizepsbt", "Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a\n" "network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be\n" "created which has the final_scriptSig and final_scriptwitness fields filled for inputs that are complete.\n" @@ -1583,7 +1583,7 @@ static RPCHelpMan finalizepsbt() RPCExamples{ HelpExampleCli("finalizepsbt", "\"psbt\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions PartiallySignedTransaction psbtx; @@ -1617,9 +1617,9 @@ static RPCHelpMan finalizepsbt() }; } -static RPCHelpMan createpsbt() +static RPCMethod createpsbt() { - return RPCHelpMan{ + return RPCMethod{ "createpsbt", "Creates a transaction in the Partially Signed Transaction format.\n" "Implements the Creator role.\n" @@ -1632,7 +1632,7 @@ static RPCHelpMan createpsbt() RPCExamples{ HelpExampleCli("createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"address\\\":0.01}]\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::optional rbf; @@ -1660,9 +1660,9 @@ static RPCHelpMan createpsbt() }; } -static RPCHelpMan converttopsbt() +static RPCMethod converttopsbt() { - return RPCHelpMan{ + return RPCMethod{ "converttopsbt", "Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n" "createpsbt and walletcreatefundedpsbt should be used for new applications.\n", @@ -1687,7 +1687,7 @@ static RPCHelpMan converttopsbt() "\nConvert the transaction to a PSBT\n" + HelpExampleCli("converttopsbt", "\"rawtransaction\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // parse hex string from parameter CMutableTransaction tx; @@ -1728,9 +1728,9 @@ static RPCHelpMan converttopsbt() }; } -static RPCHelpMan utxoupdatepsbt() +static RPCMethod utxoupdatepsbt() { - return RPCHelpMan{ + return RPCMethod{ "utxoupdatepsbt", "Updates all segwit inputs and outputs in a PSBT with data from output descriptors, the UTXO set, txindex, or the mempool.\n", { @@ -1749,7 +1749,7 @@ static RPCHelpMan utxoupdatepsbt() RPCExamples { HelpExampleCli("utxoupdatepsbt", "\"psbt\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Parse descriptors, if any. FlatSigningProvider provider; @@ -1775,9 +1775,9 @@ static RPCHelpMan utxoupdatepsbt() }; } -static RPCHelpMan joinpsbts() +static RPCMethod joinpsbts() { - return RPCHelpMan{ + return RPCMethod{ "joinpsbts", "Joins multiple distinct PSBTs with different inputs and outputs into one PSBT with inputs and outputs from all of the PSBTs\n" "No input in any of the PSBTs can be in more than one of the PSBTs.\n", @@ -1793,7 +1793,7 @@ static RPCHelpMan joinpsbts() RPCExamples { HelpExampleCli("joinpsbts", "\"psbt\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions std::vector psbtxs; @@ -1877,9 +1877,9 @@ static RPCHelpMan joinpsbts() }; } -static RPCHelpMan analyzepsbt() +static RPCMethod analyzepsbt() { - return RPCHelpMan{ + return RPCMethod{ "analyzepsbt", "Analyzes and provides information about the current status of a PSBT and its inputs\n", { @@ -1920,7 +1920,7 @@ static RPCHelpMan analyzepsbt() RPCExamples { HelpExampleCli("analyzepsbt", "\"psbt\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transaction PartiallySignedTransaction psbtx; @@ -1987,9 +1987,9 @@ static RPCHelpMan analyzepsbt() }; } -RPCHelpMan descriptorprocesspsbt() +RPCMethod descriptorprocesspsbt() { - return RPCHelpMan{ + return RPCMethod{ "descriptorprocesspsbt", "Update all segwit inputs in a PSBT with information from output descriptors, the UTXO set or the mempool. \n" "Then, sign the inputs we are able to with information from the output descriptors. ", @@ -2025,7 +2025,7 @@ RPCHelpMan descriptorprocesspsbt() HelpExampleCli("descriptorprocesspsbt", "\"psbt\" \"[\\\"descriptor1\\\", \\\"descriptor2\\\"]\"") + HelpExampleCli("descriptorprocesspsbt", "\"psbt\" \"[{\\\"desc\\\":\\\"mydescriptor\\\", \\\"range\\\":21}]\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Add descriptor information to a signing provider FlatSigningProvider provider; diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index cddd62f4aa5..77fc170da2a 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -116,9 +116,9 @@ std::string CRPCTable::help(std::string_view strCommand, const JSONRPCRequest& h return strRet; } -static RPCHelpMan help() +static RPCMethod help() { - return RPCHelpMan{ + return RPCMethod{ "help", "List all commands, or get help for a specified command.\n", { @@ -129,7 +129,7 @@ static RPCHelpMan help() RPCResult{RPCResult::Type::ANY, "", ""}, }, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& jsonRequest) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& jsonRequest) -> UniValue { auto command{self.MaybeArg("command")}; if (command == "dump_all_command_conversions") { @@ -142,10 +142,10 @@ static RPCHelpMan help() }; } -static RPCHelpMan stop() +static RPCMethod stop() { static const std::string RESULT{CLIENT_NAME " stopping"}; - return RPCHelpMan{ + return RPCMethod{ "stop", // Also accept the hidden 'wait' integer argument (milliseconds) // For instance, 'stop 1000' makes the call wait 1 second before returning @@ -156,7 +156,7 @@ static RPCHelpMan stop() }, RPCResult{RPCResult::Type::STR, "", "A string with the content '" + RESULT + "'"}, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& jsonRequest) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& jsonRequest) -> UniValue { // Event loop will exit after current HTTP requests have been handled, so // this reply will get back to the client. @@ -169,9 +169,9 @@ static RPCHelpMan stop() }; } -static RPCHelpMan uptime() +static RPCMethod uptime() { - return RPCHelpMan{ + return RPCMethod{ "uptime", "Returns the total uptime of the server.\n", {}, @@ -182,16 +182,16 @@ static RPCHelpMan uptime() HelpExampleCli("uptime", "") + HelpExampleRpc("uptime", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { return TicksSeconds(GetUptime()); } }; } -static RPCHelpMan getrpcinfo() +static RPCMethod getrpcinfo() { - return RPCHelpMan{ + return RPCMethod{ "getrpcinfo", "Returns details of the RPC server.\n", {}, @@ -212,7 +212,7 @@ static RPCHelpMan getrpcinfo() RPCExamples{ HelpExampleCli("getrpcinfo", "") + HelpExampleRpc("getrpcinfo", "")}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(g_rpc_server_info.mutex); UniValue active_commands(UniValue::VARR); diff --git a/src/rpc/server.h b/src/rpc/server.h index cb68c1def79..5355c320576 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -36,7 +36,7 @@ void SetRPCWarmupFinished(); /* returns the current warmup state. */ bool RPCIsInWarmup(std::string *outStatus); -typedef RPCHelpMan (*RpcMethodFnType)(); +typedef RPCMethod (*RpcMethodFnType)(); class CRPCCommand { diff --git a/src/rpc/signmessage.cpp b/src/rpc/signmessage.cpp index dcdc0260806..97a9f7d1950 100644 --- a/src/rpc/signmessage.cpp +++ b/src/rpc/signmessage.cpp @@ -14,9 +14,9 @@ #include -static RPCHelpMan verifymessage() +static RPCMethod verifymessage() { - return RPCHelpMan{"verifymessage", + return RPCMethod{"verifymessage", "Verify a signed message.", { {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to use for the signature."}, @@ -36,7 +36,7 @@ static RPCHelpMan verifymessage() "\nAs a JSON-RPC call\n" + HelpExampleRpc("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"signature\", \"my message\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { switch (MessageVerify(std::string{self.Arg("address")}, std::string{self.Arg("signature")}, @@ -59,9 +59,9 @@ static RPCHelpMan verifymessage() }; } -static RPCHelpMan signmessagewithprivkey() +static RPCMethod signmessagewithprivkey() { - return RPCHelpMan{ + return RPCMethod{ "signmessagewithprivkey", "Sign a message with the private key of an address\n", { @@ -79,7 +79,7 @@ static RPCHelpMan signmessagewithprivkey() "\nAs a JSON-RPC call\n" + HelpExampleRpc("signmessagewithprivkey", "\"privkey\", \"my message\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::string strPrivkey = request.params[0].get_str(); std::string strMessage = request.params[1].get_str(); diff --git a/src/rpc/txoutproof.cpp b/src/rpc/txoutproof.cpp index 89611a0c41f..d987e77b3e3 100644 --- a/src/rpc/txoutproof.cpp +++ b/src/rpc/txoutproof.cpp @@ -20,9 +20,9 @@ using node::GetTransaction; -static RPCHelpMan gettxoutproof() +static RPCMethod gettxoutproof() { - return RPCHelpMan{ + return RPCMethod{ "gettxoutproof", "Returns a hex-encoded proof that \"txid\" was included in a block.\n" "\nNOTE: By default this function only works sometimes. This is when there is an\n" @@ -41,7 +41,7 @@ static RPCHelpMan gettxoutproof() RPCResult::Type::STR, "data", "A string that is a serialized, hex-encoded data for the proof." }, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::set setTxids; UniValue txids = request.params[0].get_array(); @@ -126,9 +126,9 @@ static RPCHelpMan gettxoutproof() }; } -static RPCHelpMan verifytxoutproof() +static RPCMethod verifytxoutproof() { - return RPCHelpMan{ + return RPCMethod{ "verifytxoutproof", "Verifies that a proof points to a transaction in a block, returning the transaction it commits to\n" "and throwing an RPC error if the block is not in our best chain\n", @@ -142,7 +142,7 @@ static RPCHelpMan verifytxoutproof() } }, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CMerkleBlock merkleBlock; SpanReader{ParseHexV(request.params[0], "proof")} >> merkleBlock; diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 6c4b6a90f0c..80b08d0140c 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -542,10 +542,10 @@ struct Sections { } }; -RPCHelpMan::RPCHelpMan(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples) - : RPCHelpMan{std::move(name), std::move(description), std::move(args), std::move(results), std::move(examples), nullptr} {} +RPCMethod::RPCMethod(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples) + : RPCMethod{std::move(name), std::move(description), std::move(args), std::move(results), std::move(examples), nullptr} {} -RPCHelpMan::RPCHelpMan(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples, RPCMethodImpl fun) +RPCMethod::RPCMethod(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples, RPCMethodImpl fun) : m_name{std::move(name)}, m_fun{std::move(fun)}, m_description{std::move(description)}, @@ -632,7 +632,7 @@ std::string RPCExamples::ToDescriptionString() const return m_examples.empty() ? m_examples : "\nExamples:\n" + m_examples; } -UniValue RPCHelpMan::HandleRequest(const JSONRPCRequest& request) const +UniValue RPCMethod::HandleRequest(const JSONRPCRequest& request) const { if (request.mode == JSONRPCRequest::GET_ARGS) { return GetArgMap(); @@ -706,7 +706,7 @@ static void CheckRequiredOrDefault(const RPCArg& param) #define TMPL_INST(check_param, ret_type, return_code) \ template <> \ - ret_type RPCHelpMan::ArgValue(size_t i) const \ + ret_type RPCMethod::ArgValue(size_t i) const \ { \ const UniValue* maybe_arg{ \ DetailMaybeArg(check_param, m_args, m_req, i), \ @@ -730,7 +730,7 @@ TMPL_INST(CheckRequiredOrDefault, uint64_t, CHECK_NONFATAL(maybe_arg)->getIntgetInt();); TMPL_INST(CheckRequiredOrDefault, std::string_view, CHECK_NONFATAL(maybe_arg)->get_str();); -bool RPCHelpMan::IsValidNumArgs(size_t num_args) const +bool RPCMethod::IsValidNumArgs(size_t num_args) const { size_t num_required_args = 0; for (size_t n = m_args.size(); n > 0; --n) { @@ -742,7 +742,7 @@ bool RPCHelpMan::IsValidNumArgs(size_t num_args) const return num_required_args <= num_args && num_args <= m_args.size(); } -std::vector> RPCHelpMan::GetArgNames() const +std::vector> RPCMethod::GetArgNames() const { std::vector> ret; ret.reserve(m_args.size()); @@ -757,7 +757,7 @@ std::vector> RPCHelpMan::GetArgNames() const return ret; } -size_t RPCHelpMan::GetParamIndex(std::string_view key) const +size_t RPCMethod::GetParamIndex(std::string_view key) const { auto it{std::find_if( m_args.begin(), m_args.end(), [&key](const auto& arg) { return arg.GetName() == key;} @@ -767,7 +767,7 @@ size_t RPCHelpMan::GetParamIndex(std::string_view key) const return std::distance(m_args.begin(), it); } -std::string RPCHelpMan::ToString() const +std::string RPCMethod::ToString() const { std::string ret; @@ -830,7 +830,7 @@ std::string RPCHelpMan::ToString() const return ret; } -UniValue RPCHelpMan::GetArgMap() const +UniValue RPCMethod::GetArgMap() const { UniValue arr{UniValue::VARR}; diff --git a/src/rpc/util.h b/src/rpc/util.h index fda71072f3b..77199dfe3fd 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -429,12 +429,12 @@ struct RPCExamples { std::string ToDescriptionString() const; }; -class RPCHelpMan +class RPCMethod { public: - RPCHelpMan(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples); - using RPCMethodImpl = std::function; - RPCHelpMan(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples, RPCMethodImpl fun); + RPCMethod(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples); + using RPCMethodImpl = std::function; + RPCMethod(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples, RPCMethodImpl fun); UniValue HandleRequest(const JSONRPCRequest& request) const; /** diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index b435fb8992b..14d314618dc 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -522,7 +522,7 @@ BOOST_AUTO_TEST_CASE(check_dup_param_names) } } push_options(); - return RPCHelpMan{"method_name", "description", params, RPCResults{}, RPCExamples{""}}; + return RPCMethod{"method_name", "description", params, RPCResults{}, RPCExamples{""}}; }; // No errors if parameter names are unique. @@ -590,10 +590,10 @@ BOOST_AUTO_TEST_CASE(help_example) BOOST_CHECK_NE(HelpExampleRpcNamed("foo", {{"arg", true}}), HelpExampleRpcNamed("foo", {{"arg", "true"}})); } -static void CheckRpc(const std::vector& params, const UniValue& args, RPCHelpMan::RPCMethodImpl test_impl) +static void CheckRpc(const std::vector& params, const UniValue& args, RPCMethod::RPCMethodImpl test_impl) { auto null_result{RPCResult{RPCResult::Type::NONE, "", "None"}}; - const RPCHelpMan rpc{"dummy", "dummy description", params, null_result, RPCExamples{""}, test_impl}; + const RPCMethod rpc{"dummy", "dummy description", params, null_result, RPCExamples{""}, test_impl}; JSONRPCRequest req; req.params = args; @@ -606,7 +606,7 @@ BOOST_AUTO_TEST_CASE(rpc_arg_helper) constexpr auto DEFAULT_STRING = "default"; constexpr uint64_t DEFAULT_UINT64_T = 3; - //! Parameters with which the RPCHelpMan is instantiated + //! Parameters with which the RPCMethod is instantiated const std::vector params{ // Required arg {"req_int", RPCArg::Type::NUM, RPCArg::Optional::NO, ""}, @@ -621,7 +621,7 @@ BOOST_AUTO_TEST_CASE(rpc_arg_helper) }; //! Check that `self.Arg` returns the same value as the `request.params` accessors - RPCHelpMan::RPCMethodImpl check_positional = [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + RPCMethod::RPCMethodImpl check_positional = [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BOOST_CHECK_EQUAL(self.Arg("req_int"), request.params[0].getInt()); BOOST_CHECK_EQUAL(self.Arg("req_str"), request.params[1].get_str()); BOOST_CHECK_EQUAL(self.Arg("def_uint64_t"), request.params[2].isNull() ? DEFAULT_UINT64_T : request.params[2].getInt()); diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index a04e0903b9c..948bb4d3973 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -18,9 +18,9 @@ #include namespace wallet { -RPCHelpMan getnewaddress() +RPCMethod getnewaddress() { - return RPCHelpMan{ + return RPCMethod{ "getnewaddress", "Returns a new Bitcoin address for receiving payments.\n" "If 'label' is specified, it is added to the address book \n" @@ -36,7 +36,7 @@ RPCHelpMan getnewaddress() HelpExampleCli("getnewaddress", "") + HelpExampleRpc("getnewaddress", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -69,9 +69,9 @@ RPCHelpMan getnewaddress() }; } -RPCHelpMan getrawchangeaddress() +RPCMethod getrawchangeaddress() { - return RPCHelpMan{ + return RPCMethod{ "getrawchangeaddress", "Returns a new Bitcoin address, for receiving change.\n" "This is for use with raw transactions, NOT normal use.\n", @@ -85,7 +85,7 @@ RPCHelpMan getrawchangeaddress() HelpExampleCli("getrawchangeaddress", "") + HelpExampleRpc("getrawchangeaddress", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -115,9 +115,9 @@ RPCHelpMan getrawchangeaddress() } -RPCHelpMan setlabel() +RPCMethod setlabel() { - return RPCHelpMan{ + return RPCMethod{ "setlabel", "Sets the label associated with the given address.\n", { @@ -129,7 +129,7 @@ RPCHelpMan setlabel() HelpExampleCli("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\" \"tabby\"") + HelpExampleRpc("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\", \"tabby\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -154,9 +154,9 @@ RPCHelpMan setlabel() }; } -RPCHelpMan listaddressgroupings() +RPCMethod listaddressgroupings() { - return RPCHelpMan{ + return RPCMethod{ "listaddressgroupings", "Lists groups of addresses which have had their common ownership\n" "made public by common use as inputs or as the resulting change\n" @@ -180,7 +180,7 @@ RPCHelpMan listaddressgroupings() HelpExampleCli("listaddressgroupings", "") + HelpExampleRpc("listaddressgroupings", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -215,9 +215,9 @@ RPCHelpMan listaddressgroupings() }; } -RPCHelpMan keypoolrefill() +RPCMethod keypoolrefill() { - return RPCHelpMan{"keypoolrefill", + return RPCMethod{"keypoolrefill", "Refills each descriptor keypool in the wallet up to the specified number of new keys.\n" "By default, descriptor wallets have 4 active ranged descriptors (" + FormatAllOutputTypes() + "), each with " + util::ToString(DEFAULT_KEYPOOL_SIZE) + " entries.\n" + HELP_REQUIRING_PASSPHRASE, @@ -229,7 +229,7 @@ RPCHelpMan keypoolrefill() HelpExampleCli("keypoolrefill", "") + HelpExampleRpc("keypoolrefill", "") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -365,9 +365,9 @@ static UniValue DescribeWalletAddress(const CWallet& wallet, const CTxDestinatio return ret; } -RPCHelpMan getaddressinfo() +RPCMethod getaddressinfo() { - return RPCHelpMan{ + return RPCMethod{ "getaddressinfo", "Return information about the given bitcoin address.\n" "Some of the information will only be present if the address is in the active wallet.\n", @@ -420,7 +420,7 @@ RPCHelpMan getaddressinfo() HelpExampleCli("getaddressinfo", "\"" + EXAMPLE_ADDRESS[0] + "\"") + HelpExampleRpc("getaddressinfo", "\"" + EXAMPLE_ADDRESS[0] + "\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -512,9 +512,9 @@ RPCHelpMan getaddressinfo() }; } -RPCHelpMan getaddressesbylabel() +RPCMethod getaddressesbylabel() { - return RPCHelpMan{ + return RPCMethod{ "getaddressesbylabel", "Returns the list of addresses assigned the specified label.\n", { @@ -533,7 +533,7 @@ RPCHelpMan getaddressesbylabel() HelpExampleCli("getaddressesbylabel", "\"tabby\"") + HelpExampleRpc("getaddressesbylabel", "\"tabby\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -573,9 +573,9 @@ RPCHelpMan getaddressesbylabel() }; } -RPCHelpMan listlabels() +RPCMethod listlabels() { - return RPCHelpMan{ + return RPCMethod{ "listlabels", "Returns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n", { @@ -597,7 +597,7 @@ RPCHelpMan listlabels() "\nAs a JSON-RPC call\n" + HelpExampleRpc("listlabels", "receive") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -630,9 +630,9 @@ RPCHelpMan listlabels() #ifdef ENABLE_EXTERNAL_SIGNER -RPCHelpMan walletdisplayaddress() +RPCMethod walletdisplayaddress() { - return RPCHelpMan{ + return RPCMethod{ "walletdisplayaddress", "Display address on an external signer for verification.", { @@ -645,7 +645,7 @@ RPCHelpMan walletdisplayaddress() } }, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const wallet = GetWalletForJSONRPCRequest(request); if (!wallet) return UniValue::VNULL; diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp index 9b70f5bbb07..1e39caf5b59 100644 --- a/src/wallet/rpc/backup.cpp +++ b/src/wallet/rpc/backup.cpp @@ -36,9 +36,9 @@ using interfaces::FoundBlock; namespace wallet { -RPCHelpMan importprunedfunds() +RPCMethod importprunedfunds() { - return RPCHelpMan{ + return RPCMethod{ "importprunedfunds", "Imports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n", { @@ -47,7 +47,7 @@ RPCHelpMan importprunedfunds() }, RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -91,9 +91,9 @@ RPCHelpMan importprunedfunds() }; } -RPCHelpMan removeprunedfunds() +RPCMethod removeprunedfunds() { - return RPCHelpMan{ + return RPCMethod{ "removeprunedfunds", "Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n", { @@ -105,7 +105,7 @@ RPCHelpMan removeprunedfunds() "\nAs a JSON-RPC call\n" + HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -299,9 +299,9 @@ static UniValue ProcessDescriptorImport(CWallet& wallet, const UniValue& data, c return result; } -RPCHelpMan importdescriptors() +RPCMethod importdescriptors() { - return RPCHelpMan{ + return RPCMethod{ "importdescriptors", "Import descriptors. This will trigger a rescan of the blockchain based on the earliest timestamp of all descriptors being imported. Requires a new wallet backup.\n" "When importing descriptors with multipath key expressions, if the multipath specifier contains exactly two elements, the descriptor produced from the second element will be imported as an internal descriptor.\n" @@ -353,7 +353,7 @@ RPCHelpMan importdescriptors() "{ \"desc\": \"\", \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") + HelpExampleCli("importdescriptors", "'[{ \"desc\": \"\", \"timestamp\":1455191478, \"active\": true, \"range\": [0,100], \"label\": \"\" }]'") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& main_request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& main_request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(main_request); if (!pwallet) return UniValue::VNULL; @@ -461,9 +461,9 @@ RPCHelpMan importdescriptors() }; } -RPCHelpMan listdescriptors() +RPCMethod listdescriptors() { - return RPCHelpMan{ + return RPCMethod{ "listdescriptors", "List all descriptors present in a wallet.\n", { @@ -491,7 +491,7 @@ RPCHelpMan listdescriptors() HelpExampleCli("listdescriptors", "") + HelpExampleRpc("listdescriptors", "") + HelpExampleCli("listdescriptors", "true") + HelpExampleRpc("listdescriptors", "true") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr wallet = GetWalletForJSONRPCRequest(request); if (!wallet) return UniValue::VNULL; @@ -571,9 +571,9 @@ RPCHelpMan listdescriptors() }; } -RPCHelpMan backupwallet() +RPCMethod backupwallet() { - return RPCHelpMan{ + return RPCMethod{ "backupwallet", "Safely copies the current wallet file to the specified destination, which can either be a directory or a path with a filename.\n", { @@ -584,7 +584,7 @@ RPCHelpMan backupwallet() HelpExampleCli("backupwallet", "\"backup.dat\"") + HelpExampleRpc("backupwallet", "\"backup.dat\"") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -606,9 +606,9 @@ RPCHelpMan backupwallet() } -RPCHelpMan restorewallet() +RPCMethod restorewallet() { - return RPCHelpMan{ + return RPCMethod{ "restorewallet", "Restores and loads a wallet from backup.\n" "\nThe rescan is significantly faster if block filters are available" @@ -634,7 +634,7 @@ RPCHelpMan restorewallet() + HelpExampleCliNamed("restorewallet", {{"wallet_name", "testwallet"}, {"backup_file", "home\\backups\\backup-file.bak\""}, {"load_on_startup", true}}) + HelpExampleRpcNamed("restorewallet", {{"wallet_name", "testwallet"}, {"backup_file", "home\\backups\\backup-file.bak\""}, {"load_on_startup", true}}) }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { WalletContext& context = EnsureWalletContext(request.context); diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp index 1cf586ad009..c9215341ac2 100644 --- a/src/wallet/rpc/coins.cpp +++ b/src/wallet/rpc/coins.cpp @@ -77,9 +77,9 @@ static CAmount GetReceived(const CWallet& wallet, const UniValue& params, bool b } -RPCHelpMan getreceivedbyaddress() +RPCMethod getreceivedbyaddress() { - return RPCHelpMan{ + return RPCMethod{ "getreceivedbyaddress", "Returns the total amount received by the given address in transactions with at least minconf confirmations.\n", { @@ -102,7 +102,7 @@ RPCHelpMan getreceivedbyaddress() "\nAs a JSON-RPC call\n" + HelpExampleRpc("getreceivedbyaddress", "\"" + EXAMPLE_ADDRESS[0] + "\", 6") }, - [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -119,9 +119,9 @@ RPCHelpMan getreceivedbyaddress() } -RPCHelpMan getreceivedbylabel() +RPCMethod getreceivedbylabel() { - return RPCHelpMan{ + return RPCMethod{ "getreceivedbylabel", "Returns the total amount received by addresses with