pub fn apply_for(&self, old_root: &Cell) -> Result<Cell> {

        let old_cells = self.check(old_root)?;

        // cells for new bag
        if self.new_hash == self.old_hash {
            Ok(old_root.clone())
        } else {
            let new_root = self.traverse_on_apply(&self.new, &old_cells, &mut HashMap::new(), 0)?;

            // constructed tree's hash have to coinside with self.new_hash
            if new_root.repr_hash() != self.new_hash {
                fail!(BlockError::WrongMerkleUpdate("new bag's hash mismatch".to_string()))
            }

            Ok(new_root)
        }
    }
/// Applies update to given tree of cells by returning new updated one
Applies update to given tree of cells by returning new updated one
Applies update to given tree of cells by returning new updated one
pub fn apply_for(&self, old_root: &Cell) -> Result<Cell> {
        let old_cells = self.check(old_root)?;
        // cells for new bag
        if self.new_hash == self.old_hash {
            Ok(old_root.clone())
        } else {
            let new_root = self.traverse_on_apply(&self.new, &old_cells, &mut HashMap::new(), 0)?;
            // constructed tree's hash have to coinside with self.new_hash
            if new_root.repr_hash() != self.new_hash {
                fail!(BlockError::WrongMerkleUpdate("new bag's hash mismatch".to_string()))
            }
            Ok(new_root)
        }
    }
pub fn apply_for ( & self , old_root : & Cell ) -> Result < Cell > { let old_cells = self . check ( old_root ) ? ; // cells for new bag if self . new_hash == self . old_hash { Ok ( old_root . clone ( ) ) } else { let new_root = self . traverse_on_apply ( & self . new , & old_cells , & mut HashMap :: new ( ) , 0 ) ? ; // constructed tree's hash have to coinside with self.new_hash if new_root . repr_hash ( ) != self . new_hash { fail ! ( BlockError WrongMerkleUpdate ( " " to_string ( ) ) ) } Ok ( new_root ) } }
Applies update to given tree of cells by returning new updated one
Applies update to given tree of cells by returning new updated one
&self
old_root
&Cell
&self
old_root
&Cell