pub fn import_blocks<T: BlockTree, I: Iterator<Item = BlockHeader>, C: Clock>(
        &mut self,
        blocks: I,
        context: &C,
        tree: &mut T,
    ) -> Result<ImportResult, Error> {
        match tree.import_blocks(blocks, context) {
            Ok(ImportResult::TipChanged(tip, height, reverted)) => {
                let result = ImportResult::TipChanged(tip, height, reverted);

                self.upstream.event(Event::HeadersImported(result.clone()));
                self.upstream.event(Event::Synced(tip, height));
                self.broadcast_tip(&tip, tree);

                Ok(result)
            }
            Ok(result @ ImportResult::TipUnchanged) => {
                self.upstream.event(Event::HeadersImported(result.clone()));

                Ok(result)
            }
            Err(err) => Err(err),
        }
    }
/// Import blocks into our block tree.
Import blocks into our block tree.
Import blocks into our block tree .
pub fn import_blocks<T: BlockTree, I: Iterator<Item = BlockHeader>, C: Clock>(
        &mut self,
        blocks: I,
        context: &C,
        tree: &mut T,
    ) -> Result<ImportResult, Error> {
        match tree.import_blocks(blocks, context) {
            Ok(ImportResult::TipChanged(tip, height, reverted)) => {
                let result = ImportResult::TipChanged(tip, height, reverted);
                self.upstream.event(Event::HeadersImported(result.clone()));
                self.upstream.event(Event::Synced(tip, height));
                self.broadcast_tip(&tip, tree);
                Ok(result)
            }
            Ok(result @ ImportResult::TipUnchanged) => {
                self.upstream.event(Event::HeadersImported(result.clone()));
                Ok(result)
            }
            Err(err) => Err(err),
        }
    }
pub fn import_blocks < T : BlockTree , I : Iterator < Item = BlockHeader > , C : Clock > ( & mut self , blocks : I , context : & C , tree : & mut T , ) -> Result < ImportResult , Error > { match tree . import_blocks ( blocks , context ) { Ok ( ImportResult :: TipChanged ( tip , height , reverted ) ) => { let result = ImportResult :: TipChanged ( tip , height , reverted ) ; self . upstream . event ( Event :: HeadersImported ( result . clone ( ) ) ) ; self . upstream . event ( Event :: Synced ( tip , height ) ) ; self . broadcast_tip ( & tip , tree ) ; Ok ( result ) } Ok ( result @ ImportResult :: TipUnchanged ) => { self . upstream . event ( Event :: HeadersImported ( result . clone ( ) ) ) ; Ok ( result ) } Err ( err ) => Err ( err ) , } }
Import blocks into our block tree.
Import blocks into our block tree .
&mut self
blocks
I
context
&C
tree
&mut T