@@ -128,9 +128,11 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
128
128
if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
129
129
throw runtime_error (
130
130
" getrawtransaction \" txid\" ( verbose )\n "
131
- " \n NOTE: By default this function only works sometimes. This is when the tx is in the mempool\n "
132
- " or there is an unspent output in the utxo for this transaction. To make it always work,\n "
133
- " you need to maintain a transaction index, using the -txindex command line option.\n "
131
+
132
+ " \n NOTE: By default this function only works for mempool transactions. If the -txindex option is\n "
133
+ " enabled, it also works for blockchain transactions.\n "
134
+ " DEPRECATED: for now, it also works for transactions with unspent outputs.\n "
135
+
134
136
" \n Return the raw transaction data.\n "
135
137
" \n If verbose is 'true', returns an Object with information about 'txid'.\n "
136
138
" If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n "
@@ -218,7 +220,9 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
218
220
CTransactionRef tx;
219
221
uint256 hashBlock;
220
222
if (!GetTransaction (hash, tx, Params ().GetConsensus (), hashBlock, true ))
221
- throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " No information available about transaction" );
223
+ throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, std::string (fTxIndex ? " No such mempool or blockchain transaction"
224
+ : " No such mempool transaction. Use -txindex to enable blockchain transaction queries" ) +
225
+ " . Use gettransaction for wallet transactions." );
222
226
223
227
string strHex = EncodeHexTx (*tx, RPCSerializationFlags ());
224
228
0 commit comments