pub fn merkle_proof<H, I>(leaves: I, leaf_index: u64) -> MerkleProofwhere
H: Hash<Output = H256>,
I: Iterator<Item = H256>,
Expand description
Construct a Merkle Proof for leaves given by indices.
The function constructs a (partial) Merkle Tree first and stores all elements required to prove the requested item (leaf) given the root hash.
Both the Proof and the Root Hash are returned.
§Panic
The function will panic if given leaf_index
is greater than the number of leaves.