Skip to content

Commit a0d4e79

Browse files
committed
Merge #15477: doc: Remove misleading hint in getrawtransaction
9999879 refactor: Use RPCHelpMan::IsValidNumArgs in getrawtransaction (MarcoFalke) fa9ff8f doc: Remove misleading hint in getrawtransaction (MarcoFalke) Pull request description: For 0.18.0 I asked this line to be added in #15159, which was wrong because getmempoolentry does not return the raw transaction hex. Tree-SHA512: 7ac85500c8192314347b7283cd369196bb959c124863642b6c1ce73d5662b1cbe4f42ded9c374dac6657458ab70b01810caf1235dd1d2b404bf376ebf09efa69
2 parents a4f9c02 + 9999879 commit a0d4e79

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include <chain.h>
77
#include <coins.h>
88
#include <compat/byteswap.h>
9-
#include <consensus/validation.h>
109
#include <consensus/tx_verify.h>
10+
#include <consensus/validation.h>
1111
#include <core_io.h>
1212
#include <index/txindex.h>
1313
#include <init.h>
@@ -67,9 +67,7 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
6767

6868
static UniValue getrawtransaction(const JSONRPCRequest& request)
6969
{
70-
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
71-
throw std::runtime_error(
72-
RPCHelpMan{
70+
const RPCHelpMan help{
7371
"getrawtransaction",
7472
"\nReturn the raw transaction data.\n"
7573

@@ -79,8 +77,7 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
7977
"will return the transaction if it is in the mempool, or if -txindex is enabled and the transaction\n"
8078
"is in a block in the blockchain.\n"
8179

82-
"\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n"
83-
"Or use gettransaction for wallet transactions.\n"
80+
"\nHint: Use gettransaction for wallet transactions.\n"
8481

8582
"\nIf verbose is 'true', returns an Object with information about 'txid'.\n"
8683
"If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n",
@@ -148,7 +145,11 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
148145
+ HelpExampleCli("getrawtransaction", "\"mytxid\" false \"myblockhash\"")
149146
+ HelpExampleCli("getrawtransaction", "\"mytxid\" true \"myblockhash\"")
150147
},
151-
}.ToString());
148+
};
149+
150+
if (request.fHelp || !help.IsValidNumArgs(request.params.size())) {
151+
throw std::runtime_error(help.ToString());
152+
}
152153

153154
bool in_active_chain = true;
154155
uint256 hash = ParseHashV(request.params[0], "parameter 1");

0 commit comments

Comments
 (0)