aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorJameson Lopp <jameson@team.casa>2021-07-01 10:17:28 -0400
committerJameson Lopp <jameson.lopp@gmail.com>2021-07-03 07:31:27 -0400
commit78f4c8b98eada337346ffb206339c3ebae4ff43b (patch)
tree5f08795aaacdf50ee7cf7d5481d5f0173fbaab20 /src/validation.h
parent2749613020ed96a4e9204f8b98c44524b0a62d0d (diff)
downloadbitcoin-78f4c8b98eada337346ffb206339c3ebae4ff43b.tar.xz
prefer to use txindex if available for GetTransaction
Fixes #22382
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/validation.h b/src/validation.h
index fc702b7183..0cebf3967d 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -142,15 +142,16 @@ void StartScriptCheckWorkerThreads(int threads_num);
/** Stop all of the script checking worker threads */
void StopScriptCheckWorkerThreads();
/**
- * Return transaction from the block at block_index.
- * If block_index is not provided, fall back to mempool.
- * If mempool is not provided or the tx couldn't be found in mempool, fall back to g_txindex.
+ * Return transaction with a given hash.
+ * If mempool is provided and block_index is not provided, check it first for the tx.
+ * If -txindex is available, check it next for the tx.
+ * Finally, if block_index is provided, check for tx by reading entire block from disk.
*
* @param[in] block_index The block to read from disk, or nullptr
- * @param[in] mempool If block_index is not provided, look in the mempool, if provided
+ * @param[in] mempool If provided, check mempool for tx
* @param[in] hash The txid
* @param[in] consensusParams The params
- * @param[out] hashBlock The hash of block_index, if the tx was found via block_index
+ * @param[out] hashBlock The block hash, if the tx was found via -txindex or block_index
* @returns The tx if found, otherwise nullptr
*/
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock);