Merge 7925f3aba8 into merged_master (Bitcoin PR bitcoin/bitcoin#22383)

This commit is contained in:
Glenn Willen 2023-03-22 03:54:56 +00:00
commit 7050d04a75
3 changed files with 24 additions and 20 deletions

View file

@ -1248,6 +1248,20 @@ CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMe
{
LOCK(cs_main);
if (mempool && !block_index) {
CTransactionRef ptx = mempool->get(hash);
if (ptx) return ptx;
}
if (g_txindex) {
CTransactionRef tx;
uint256 block_hash;
if (g_txindex->FindTx(hash, block_hash, tx)) {
if (!block_index || block_index->GetBlockHash() == block_hash) {
hashBlock = block_hash;
return tx;
}
}
}
if (block_index) {
CBlock block;
if (ReadBlockFromDisk(block, block_index, consensusParams)) {
@ -1258,15 +1272,6 @@ CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMe
}
}
}
return nullptr;
}
if (mempool) {
CTransactionRef ptx = mempool->get(hash);
if (ptx) return ptx;
}
if (g_txindex) {
CTransactionRef tx;
if (g_txindex->FindTx(hash, hashBlock, tx)) return tx;
}
return nullptr;
}