Skip to main content

merkle_path

Function merkle_path 

Source
pub fn merkle_path(
    builder: &CircuitBuilder,
    leaf: [Wire; 4],
    siblings: &[([Wire; 4], Wire)],
    length: Wire,
) -> [Wire; 4]
Expand description

Returns the merkle root obtained by folding leaf with siblings under double-SHA256.

Every wire is Bitcoin little-endian packed (8 bytes per wire).

Each sibling carries a wire saying whether it is a left or a right sibling, in the encoding SiblingSide::to_word produces. siblings.len() is the maximal path length; only the first length siblings are folded in, and the remaining levels pass the running digest through unchanged.