diff options
-rw-r--r-- | src/node/transaction.cpp | 3 | ||||
-rw-r--r-- | src/rpc/rawtransaction.cpp | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 0227618edf..4de0b302e6 100644 --- a/src/node/transaction.cpp +++ b/src/node/transaction.cpp @@ -121,6 +121,9 @@ CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMe uint256 block_hash; if (g_txindex->FindTx(hash, block_hash, tx)) { 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; return tx; } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 30addf8af6..ed5e1d8c46 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -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" "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" - "the specified block is available and the transaction is found in that block.\n" + "If a blockhash argument is passed, it will return the transaction if\n" + "the specified block is available and the transaction is in that block.\n" "\nHint: Use gettransaction for wallet transactions.\n" "\nIf verbose is 'true', returns an Object with information about 'txid'.\n" |