aboutsummaryrefslogtreecommitdiff
path: root/src/node/transaction.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2021-07-22 20:32:04 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-07-22 20:35:14 +0200
commitf685a13bef0418663015ea6d8f448f075510c0ec (patch)
tree5267f47ff785c1b0dac2a1b0bcec1a883d1bd2e4 /src/node/transaction.cpp
parentabc57e1f0882a1a2bb20474648419979af6e383d (diff)
downloadbitcoin-f685a13bef0418663015ea6d8f448f075510c0ec.tar.xz
doc: GetTransaction()/getrawtransaction follow-ups to #22383
Diffstat (limited to 'src/node/transaction.cpp')
-rw-r--r--src/node/transaction.cpp3
1 files changed, 3 insertions, 0 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;
}