ComputeMerkleRoot

Compute a Merkle root from the provided leaf hashes. If non-null, *mutated is set to true if two identical hashes are paired at any tree level before the odd-count hash duplication step, and false otherwise.

Synopsis

Declared in <consensus/merkle.h>

uint256
ComputeMerkleRoot(
    std::vector<uint256> hashes,
    bool* mutated = nullptr);

Return Value

The Merkle root of the given hashes.

Parameters

NameDescription
hashesThe leaf hashes to build the tree from.
mutatedIf non-null, receives whether a pair of identical hashes was detected.