[#CPartialMerkleTree-TraverseAndExtract]
= xref:CPartialMerkleTree.adoc[CPartialMerkleTree]::TraverseAndExtract
:relfileprefix: ../
:mrdocs:

recursive function that traverses tree nodes, consuming the bits and hashes produced by TraverseAndBuild&period; it returns the hash of the respective node and its respective index&period;

== Synopsis

Declared in `&lt;merkleblock&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:uint256.adoc[uint256]
TraverseAndExtract(
    int height,
    unsigned int pos,
    unsigned int& nBitsUsed,
    unsigned int& nHashUsed,
    std::vector&lt;Txid&gt;& vMatch,
    std::vector&lt;unsigned int&gt;& vnIndex);
----

== Return Value

The hash of the current node&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *height*
| The tree level of the current node, counted from the leaf level (height 0) upward&period;
| *pos*
| The position of the current node within its level&period;
| *nBitsUsed*
| Running count of flag bits consumed so far&semi; advanced as bits are read&period;
| *nHashUsed*
| Running count of hashes consumed so far&semi; advanced as hashes are read&period;
| *vMatch*
| Output list of matched transaction ids collected during traversal&period;
| *vnIndex*
| Output list of the indices of the matched transactions within the tree&period;
|===


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