fn validate_sub_tree_proof<A: Algorithm<T>>(&self, arity: usize) -> Result<bool> {
        // Ensure that the sub_tree validates to the root of that
        // sub_tree.
        let valid = self.sub_tree_proof.as_ref().unwrap().validate::<A>()?;
        if !valid {
            return Ok(valid);
        }

        // Validate top-most/current layer
        //
        // Check that the remaining proof matches the tree root (note
        // that Proof::validate at the base layer cannot handle a
        // proof this small, so this is a version specific for what we
        // know we have in this case).
        let mut a = A::default();
        a.reset();
        let node_count = arity;
        let h = {
            let mut nodes: Vec<T> = Vec::with_capacity(node_count);
            let mut cur_index = 0;
            for j in 0..node_count {
                if j == self.path()[0] {
                    nodes.push(self.sub_tree_root().clone());
                } else {
                    nodes.push(self.lemma()[cur_index].clone());
                    cur_index += 1;
                }
            }

            if cur_index != node_count - 1 {
                return Ok(false);
            }

            a.multi_node(&nodes, 0)
        };

        Ok(h == self.root())
    }
/// Validates sub-tree proofs with the specified arity.
Validates sub-tree proofs with the specified arity.
Validates sub - tree proofs with the specified arity .
fn validate_sub_tree_proof<A: Algorithm<T>>(&self, arity: usize) -> Result<bool> {
        // Ensure that the sub_tree validates to the root of that
        // sub_tree.
        let valid = self.sub_tree_proof.as_ref().unwrap().validate::<A>()?;
        if !valid {
            return Ok(valid);
        }
        // Validate top-most/current layer
        //
        // Check that the remaining proof matches the tree root (note
        // that Proof::validate at the base layer cannot handle a
        // proof this small, so this is a version specific for what we
        // know we have in this case).
        let mut a = A::default();
        a.reset();
        let node_count = arity;
        let h = {
            let mut nodes: Vec<T> = Vec::with_capacity(node_count);
            let mut cur_index = 0;
            for j in 0..node_count {
                if j == self.path()[0] {
                    nodes.push(self.sub_tree_root().clone());
                } else {
                    nodes.push(self.lemma()[cur_index].clone());
                    cur_index += 1;
                }
            }
            if cur_index != node_count - 1 {
                return Ok(false);
            }
            a.multi_node(&nodes, 0)
        };
        Ok(h == self.root())
    }
fn validate_sub_tree_proof < A : Algorithm < T > > ( & self , arity : usize ) -> Result < bool > { // Ensure that the sub_tree validates to the root of that // sub_tree. let valid = self . sub_tree_proof . as_ref ( ) . unwrap ( ) . validate :: < A > ( ) ? ; if ! valid { return Ok ( valid ) ; } // Validate top-most/current layer // // Check that the remaining proof matches the tree root (note // that Proof::validate at the base layer cannot handle a // proof this small, so this is a version specific for what we // know we have in this case). let mut a = A :: default ( ) ; a . reset ( ) ; let node_count = arity ; let h = { let mut nodes : Vec < T > = Vec :: with_capacity ( node_count ) ; let mut cur_index = 0 ; for j in 0 .. node_count { if j == self . path ( ) [ 0 ] { nodes . push ( self . sub_tree_root ( ) . clone ( ) ) ; } else { nodes . push ( self . lemma ( ) [ cur_index ] . clone ( ) ) ; cur_index += 1 ; } } if cur_index != node_count - 1 { return Ok ( false ) ; } a . multi_node ( & nodes , 0 ) } ; Ok ( h == self . root ( ) ) }
Validates sub-tree proofs with the specified arity.
Validates sub - tree proofs with the specified arity .
&self
arity
usize