in src/proof.rs [305:325]
fn generate_inclusion_proof(tree: &Self::TreeStruct, list: &[TreeIndex]) -> Option<Self> {
if list.len() == 1 {
// Get the references to the input leaf and siblings of nodes long the Merkle path from the root to the leaves.
let refs = tree.get_merkle_path_ref(&list[0]);
refs.as_ref()?;
let refs = refs.unwrap();
// Construct the Merkle proof given the references to all sibling nodes in the proof.
let mut proof = MerkleProof::<P>::new(list[0]);
proof.set_siblings(tree.get_node_proof_by_refs(&refs[1..]));
Some(proof)
} else {
// Get the references to the input leaves and siblings of nodes long the batched Merkle paths from the root to the leaves.
let refs = tree.get_merkle_path_ref_batch(list);
refs.as_ref()?;
let refs = refs.unwrap();
// Construct the batched Merkle proof given the references to all sibling nodes in the proof.
let mut proof = MerkleProof::<P>::new_batch(list);
proof.set_siblings(tree.get_node_proof_by_refs(&refs[list.len()..]));
Some(proof)
}
}