referrerpolicy=no-referrer-when-downgrade

Function merkle_proof_raw

Source
pub fn merkle_proof_raw<H, I>(
    leaves: I,
    leaf_index: u32,
) -> MerkleProof<H::Out, H::Out>
where H: Hasher, H::Out: Default + Copy + AsRef<[u8]>, I: IntoIterator<Item = H::Out>, I::IntoIter: ExactSizeIterator,
Expand description

Construct a Merkle Proof for leaves given by indices.

This is a raw version of the merkle_proof function that expects the hashes of the leaves and not the leaves itself.

The function constructs a (partial) Merkle Tree first and stores all elements required to prove requested item (leaf) given the root hash.

Both the Proof and the Root Hash is returned.

§Panic

The function will panic if given leaf_index is greater than the number of leaves.