Skip to main content

reduce_merkle_root

Function reduce_merkle_root 

Source
fn reduce_merkle_root(
    hashes: Vec<[u8; 32]>,
    hash_pair: impl Fn(&[u8; 32], &[u8; 32]) -> [u8; 32] + Sync,
) -> [u8; 32]
Expand description

Reduce ordered leaves, duplicating an unpaired final node at each level.

Auth-data trees are padded before calling this helper, so their levels always contain pairs. Reuse two buffers across levels, with disjoint output chunks preserving left/right order.