[#node-GetTransaction]
= xref:node.adoc[node]::GetTransaction
:relfileprefix: ../
:mrdocs:

Return transaction with a given hash&period; If mempool is provided and block&lowbar;index is not provided, check it first for the tx&period; If &hyphen;txindex is available, check it next for the tx&period; Finally, if block&lowbar;index is provided, check for tx by reading entire block from disk&period;

== Synopsis

Declared in `&lt;node&sol;transaction&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:CTransactionRef.adoc[CTransactionRef]
GetTransaction(
    xref:CBlockIndex.adoc[CBlockIndex] const* block&lowbar;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&lowbar;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 &hyphen;txindex or block&lowbar;index
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
