CPartialMerkleTree::TraverseAndExtract

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

Synopsis

Declared in <merkleblock.h>

uint256
TraverseAndExtract(
    int height,
    unsigned int pos,
    unsigned int& nBitsUsed,
    unsigned int& nHashUsed,
    std::vector<Txid>& vMatch,
    std::vector<unsigned int>& vnIndex);

Return Value

The hash of the current node.

Parameters

NameDescription
heightThe tree level of the current node, counted from the leaf level (height 0) upward.
posThe position of the current node within its level.
nBitsUsedRunning count of flag bits consumed so far; advanced as bits are read.
nHashUsedRunning count of hashes consumed so far; advanced as hashes are read.
vMatchOutput list of matched transaction ids collected during traversal.
vnIndexOutput list of the indices of the matched transactions within the tree.