doc: GetTransaction()/getrawtransaction follow-ups to #22383

This commit is contained in:
John Newbery 2021-07-22 20:32:04 +02:00 committed by Sebastian Falbesoner
parent abc57e1f08
commit f685a13bef
2 changed files with 5 additions and 2 deletions

View file

@ -121,6 +121,9 @@ CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMe
uint256 block_hash; uint256 block_hash;
if (g_txindex->FindTx(hash, block_hash, tx)) { if (g_txindex->FindTx(hash, block_hash, tx)) {
if (!block_index || block_index->GetBlockHash() == block_hash) { if (!block_index || block_index->GetBlockHash() == block_hash) {
// Don't return the transaction if the provided block hash doesn't match.
// The case where a transaction appears in multiple blocks (e.g. reorgs or
// BIP30) is handled by the block lookup below.
hashBlock = block_hash; hashBlock = block_hash;
return tx; return tx;
} }

View file

@ -76,8 +76,8 @@ static RPCHelpMan getrawtransaction()
"\nBy default, this call only returns a transaction if it is in the mempool. If -txindex is enabled\n" "\nBy default, this call only returns a transaction if it is in the mempool. If -txindex is enabled\n"
"and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block.\n" "and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block.\n"
"If -txindex is not enabled and a blockhash argument is passed, it will return the transaction if\n" "If a blockhash argument is passed, it will return the transaction if\n"
"the specified block is available and the transaction is found in that block.\n" "the specified block is available and the transaction is in that block.\n"
"\nHint: Use gettransaction for wallet transactions.\n" "\nHint: Use gettransaction for wallet transactions.\n"
"\nIf verbose is 'true', returns an Object with information about 'txid'.\n" "\nIf verbose is 'true', returns an Object with information about 'txid'.\n"