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.
Declared in <node/transaction.h>
CTransactionRef
GetTransaction(
CBlockIndex const* block_index,
CTxMemPool const* mempool,
Txid const& hash,
BlockManager const& blockman,
uint256& hashBlock);
The tx if found, otherwise nullptr
| Name | Description |
|---|---|
| block_index [in] | The block to read from disk, or nullptr |
| mempool [in] | If provided, check mempool for tx |
| hash [in] | The txid |
| blockman [in] | Used to access and read blocks from disk |
| hashBlock [out] | The block hash, if the tx was found via -txindex or block_index |