fn update_base_mmr(&mut self) -> Result<(), MerkleMountainRangeError> {
        let prev_cp_index = self.base_cp_index;
        self.base_cp_index = self.calculate_base_cp_index()?;
        if prev_cp_index < self.base_cp_index {
            for cp_index in prev_cp_index + 1..=self.base_cp_index {
                if let Some(cp) = self
                    .checkpoints
                    .get(cp_index)
                    .map_err(|e| MerkleMountainRangeError::BackendError(e.to_string()))?
                {
                    cp.apply(&mut self.base_mmr)?;
                }
            }
        } else {
            self.create_base_mmr()?;
        }
        Ok(())
    }
// An update to the checkpoints have been detected, update the base MMR to the correct position.
An update to the checkpoints have been detected, update the base MMR to the correct position.
An update to the checkpoints have been detected update the base MMR to the correct position .
fn update_base_mmr(&mut self) -> Result<(), MerkleMountainRangeError> {
        let prev_cp_index = self.base_cp_index;
        self.base_cp_index = self.calculate_base_cp_index()?;
        if prev_cp_index < self.base_cp_index {
            for cp_index in prev_cp_index + 1..=self.base_cp_index {
                if let Some(cp) = self
                    .checkpoints
                    .get(cp_index)
                    .map_err(|e| MerkleMountainRangeError::BackendError(e.to_string()))?
                {
                    cp.apply(&mut self.base_mmr)?;
                }
            }
        } else {
            self.create_base_mmr()?;
        }
        Ok(())
    }
fn update_base_mmr ( & mut self ) -> Result < ( ) , MerkleMountainRangeError > { let prev_cp_index = self . base_cp_index ; self . base_cp_index = self . calculate_base_cp_index ( ) ? ; if prev_cp_index < self . base_cp_index { for cp_index in prev_cp_index + 1 ..= self . base_cp_index { if let Some ( cp ) = self . checkpoints . get ( cp_index ) . map_err ( | e | MerkleMountainRangeError :: BackendError ( e . to_string ( ) ) ) ? { cp . apply ( & mut self . base_mmr ) ? ; } } } else { self . create_base_mmr ( ) ? ; } Ok ( ( ) ) }
An update to the checkpoints have been detected, update the base MMR to the correct position.
An update to the checkpoints have been detected update the base MMR to the correct position .
&mut self
&mut self