I am using below code to create Merkle Root.
pub type MmrRootHash = H256;
pub fn create_merkle_root(leaves: Vec<MmrRootHash>) -> MmrRootHash {
sp_runtime::traits::BlakeTwo256::trie_root(
leaves
.iter()
.enumerate()
.map(|(i, l)| ((i as u32).encode(), l.encode()))
.collect()
);
}
I want to verify Merkle Root of a leaf with its batch root and adjacent_leaves. Can somebody help me to provide library for the same?
fn verify_merkle_root(root: MmrRootHash, batch_root: MmrRootHash, adjacent_leaves: Vec< MmrRootHash >) -> bool {
..
}