[#wallet-CWallet-GetTxDepthInMainChain]
= xref:wallet.adoc[wallet]::xref:wallet/CWallet.adoc[CWallet]::GetTxDepthInMainChain
:relfileprefix: ../../
:mrdocs:

Return depth of transaction in blockchain&colon; &lt;0 &colon; conflicts with a transaction this deep in the blockchain 0 &colon; in memory pool, waiting to be included in a block &gt;&equals;1 &colon; this many blocks deep in the main chain

== Synopsis

Declared in `&lt;wallet&sol;wallet&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;requires&lowbar;capability(0x7f2e1e597cf8), requires&lowbar;capability(0x7f2e11aa8ab8), requires&lowbar;capability(0x7f2e169fe8a8), requires&lowbar;capability(0x7f2e15f2dd48), requires&lowbar;capability(0x7f2e12c6c9d8)&rsqb;&rsqb;
int
GetTxDepthInMainChain(xref:wallet/CWalletTx.adoc[CWalletTx] const& wtx) const;
----

== Description

Preconditions&colon; it is only valid to call this function when the wallet is online and the block index is loaded&period; So this cannot be called by bitcoin&hyphen;wallet tool code or by wallet migration code&period; If this is called without the wallet being online, it won&apos;t be able able to determine the the height of the last block processed, or the heights of blocks referenced in transaction, and might cause assert failures&period;

== Return Value

the transaction depth as described above

== Parameters

[cols="1,4"]
|===
| Name| Description
| *wtx*
| the wallet transaction to measure
|===


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