[#node-GetTransaction] = xref:node.adoc[node]::GetTransaction :relfileprefix: ../ :mrdocs: 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. == Synopsis Declared in `<node/transaction.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:CTransactionRef.adoc[CTransactionRef] GetTransaction( xref:CBlockIndex.adoc[CBlockIndex] const* block_index, xref:CTxMemPool.adoc[CTxMemPool] const* mempool, xref:Txid.adoc[Txid] const& hash, xref:node/BlockManager.adoc[BlockManager] const& blockman, xref:uint256.adoc[uint256]& hashBlock); ---- == Return Value The tx if found, otherwise nullptr == Parameters [cols="1,4"] |=== | 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 |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#