New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RPC] Remove lookup to UTXO set from GetTransaction #15159
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,12 +67,11 @@ static UniValue getrawtransaction(const JSONRPCRequest& request) | |
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) | ||
throw std::runtime_error( | ||
RPCHelpMan{"getrawtransaction", | ||
"\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n" | ||
"enabled, it also works for blockchain transactions. If the block which contains the transaction\n" | ||
"is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is\n" | ||
"provided, only that block will be searched and if the transaction is in the mempool or other\n" | ||
"blocks, or if this node does not have the given block available, the transaction will not be found.\n" | ||
"DEPRECATED: for now, it also works for transactions with unspent outputs.\n" | ||
"\nBy default this function only works for mempool transactions. When called with a blockhash\n" | ||
"argument, getrawtransaction will return the transaction if the specified block is available and\n" | ||
"the transaction is found in that block. When called without a blockhash argument, getrawtransaction\n" | ||
"will return the transaction if it is in the mempool, or if -txindex is enabled and the transaction\n" | ||
"is in a block in the blockchain.\n" | ||
|
||
"\nReturn the raw transaction data.\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Could move this up to the first line, since this is the oneline-summary of what the function does. The paragraph above is the implementation detail and interface documentation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, you could mention the corresponding raw transaction getter rpcs for the mempool and wallet, but that is another perpendicular doc cleanup fix. |
||
"\nIf verbose is 'true', returns an Object with information about 'txid'.\n" | ||
|
@@ -175,7 +174,7 @@ static UniValue getrawtransaction(const JSONRPCRequest& request) | |
|
||
CTransactionRef tx; | ||
uint256 hash_block; | ||
if (!GetTransaction(hash, tx, Params().GetConsensus(), hash_block, true, blockindex)) { | ||
if (!GetTransaction(hash, tx, Params().GetConsensus(), hash_block, blockindex)) { | ||
std::string errmsg; | ||
if (blockindex) { | ||
if (!(blockindex->nStatus & BLOCK_HAVE_DATA)) { | ||
|
@@ -270,7 +269,7 @@ static UniValue gettxoutproof(const JSONRPCRequest& request) | |
if (pblockindex == nullptr) | ||
{ | ||
CTransactionRef tx; | ||
if (!GetTransaction(oneTxid, tx, Params().GetConsensus(), hashBlock, false) || hashBlock.IsNull()) | ||
if (!GetTransaction(oneTxid, tx, Params().GetConsensus(), hashBlock) || hashBlock.IsNull()) | ||
amitiuttarwar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block"); | ||
pblockindex = LookupBlockIndex(hashBlock); | ||
if (!pblockindex) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc-nit: Change applies to rpc and rest