fn import_blocks<I: Iterator<Item = BlockHeader>, C: Clock>(
        &mut self,
        chain: I,
        context: &C,
    ) -> Result<ImportResult, Error> {
        let mut result = None;

        for (i, header) in chain.enumerate() {
            match self.import_block(header, context) {
                Ok(r) => result = Some(r),
                Err(Error::DuplicateBlock(hash)) => log::trace!("Duplicate block {}", hash),
                Err(Error::BlockMissing(hash)) => log::trace!("Missing block {}", hash),
                Err(err) => return Err(Error::BlockImportAborted(err.into(), i, self.height())),
            }
        }
        Ok(result.unwrap_or(ImportResult::TipUnchanged))
    }
/// Import blocks into the block tree. Blocks imported this way don't have to form a chain.
Import blocks into the block tree. Blocks imported this way don't have to form a chain.
Import blocks into the block tree . Blocks imported this way don ' t have to form a chain .
fn import_blocks<I: Iterator<Item = BlockHeader>, C: Clock>(
        &mut self,
        chain: I,
        context: &C,
    ) -> Result<ImportResult, Error> {
        let mut result = None;
        for (i, header) in chain.enumerate() {
            match self.import_block(header, context) {
                Ok(r) => result = Some(r),
                Err(Error::DuplicateBlock(hash)) => log::trace!("Duplicate block {}", hash),
                Err(Error::BlockMissing(hash)) => log::trace!("Missing block {}", hash),
                Err(err) => return Err(Error::BlockImportAborted(err.into(), i, self.height())),
            }
        }
        Ok(result.unwrap_or(ImportResult::TipUnchanged))
    }
fn import_blocks < I : Iterator < Item = BlockHeader > , C : Clock > ( & mut self , chain : I , context : & C , ) -> Result < ImportResult , Error > { let mut result = None ; for ( i , header ) in chain . enumerate ( ) { match self . import_block ( header , context ) { Ok ( r ) => result = Some ( r ) , Err ( Error :: DuplicateBlock ( hash ) ) => log :: trace ! ( " " hash ) , Err ( Error :: BlockMissing ( hash ) ) => log :: trace ! ( " " hash ) , Err ( err ) => return Err ( Error :: BlockImportAborted ( err . into ( ) , i , self . height ( ) ) ) , } } Ok ( result . unwrap_or ( ImportResult :: TipUnchanged ) ) }
Import blocks into the block tree.
Import blocks into the block tree .
&mut self
chain
I
context
&C