pub fn merkle_path(&self, index: ItemIndex) -> Vec<(Hash, bool)> {
        // print!("Making a proof for index {}\n", index);
        assert!(index < self.capacity());
        let mut hash_index = (self.tree_depth, index);

        (0..self.tree_depth)
            .rev()
            .map(|_level| {
                let dir = (hash_index.1 & 1) > 0;
                let proof_index = (hash_index.0, hash_index.1 ^ 1);
                let hash = self.get_hash(proof_index);
                hash_index = (hash_index.0 - 1, hash_index.1 >> 1);
                (hash, dir)
            })
            .collect()
    }
/// Creates a proof of existence for a certain element of the tree.
/// Returned value is a list of pairs, where the first element is
/// the aggregated coupling hash for current layer, and the second is
/// the direction.
Creates a proof of existence for a certain element of the tree.
Returned value is a list of pairs, where the first element is
the aggregated coupling hash for current layer, and the second is
the direction.
Creates a proof of existence for a certain element of the tree . Returned value is a list of pairs where the first element is the aggregated coupling hash for current layer and the second is the direction .
pub fn merkle_path(&self, index: ItemIndex) -> Vec<(Hash, bool)> {
        // print!("Making a proof for index {}\n", index);
        assert!(index < self.capacity());
        let mut hash_index = (self.tree_depth, index);
        (0..self.tree_depth)
            .rev()
            .map(|_level| {
                let dir = (hash_index.1 & 1) > 0;
                let proof_index = (hash_index.0, hash_index.1 ^ 1);
                let hash = self.get_hash(proof_index);
                hash_index = (hash_index.0 - 1, hash_index.1 >> 1);
                (hash, dir)
            })
            .collect()
    }
pub fn merkle_path ( & self , index : ItemIndex ) -> Vec < ( Hash , bool ) > { // print!("Making a proof for index {}\n", index); assert ! ( index self capacity ( ) ) ; let mut hash_index = ( self . tree_depth , index ) ; ( 0 .. self . tree_depth ) . rev ( ) . map ( | _level | { let dir = ( hash_index . 1 & 1 ) > 0 ; let proof_index = ( hash_index . 0 , hash_index . 1 ^ 1 ) ; let hash = self . get_hash ( proof_index ) ; hash_index = ( hash_index . 0 - 1 , hash_index . 1 >> 1 ) ; ( hash , dir ) } ) . collect ( ) }
Creates a proof of existence for a certain element of the tree.
Creates a proof of existence for a certain element of the tree .
&self
index
ItemIndex