monero_serai::merkle

Function merkle_root

Source
pub fn merkle_root(leafs: Vec<[u8; 32]>) -> Option<[u8; 32]>
Expand description

Calculates the Merkle root of the given tree. Equivalent to tree_hash in monero-core: https://github.com/monero-project/monero/blob/893916ad091a92e765ce3241b94e706ad012b62a /src/crypto/tree-hash.c#L62

This function returns None if the tree is empty.