pub fn run_with<T: BlockTree, F: Filters, P: peer::Store>(
        mut self,
        cache: T,
        filters: F,
        peers: P,
    ) -> Result<(), Error> {
        let cfg = p2p::protocol::Config {
            services: self.config.services,
            ..p2p::protocol::Config::from(
                self.config.name,
                self.config.network,
                self.config.connect,
            )
        };

        log::info!("Initializing client ({:?})..", cfg.network);
        log::info!("Genesis block hash is {}", cfg.network.genesis_hash());
        log::info!("Chain height is {}", cache.height());

        let local_time = SystemTime::now().into();
        let clock = AdjustedTime::<net::SocketAddr>::new(local_time);
        let rng = fastrand::Rng::new();

        log::info!("{} peer(s) found..", peers.len());

        self.reactor.on_event({
            let blocks = self.blocks;
            let filters = self.filters;

            move |event| Self::process_event(event, blocks.clone(), filters.clone())
        });
        self.reactor.run(&self.config.listen, |upstream| {
            Protocol::new(cache, filters, peers, clock, rng, cfg, upstream)
        })?;

        Ok(())
    }
/// Start the client process, supplying the block cache. This function is meant to be run in
/// its own thread.
Start the client process, supplying the block cache. This function is meant to be run in
its own thread.
Start the client process supplying the block cache . This function is meant to be run in its own thread .
pub fn run_with<T: BlockTree, F: Filters, P: peer::Store>(
        mut self,
        cache: T,
        filters: F,
        peers: P,
    ) -> Result<(), Error> {
        let cfg = p2p::protocol::Config {
            services: self.config.services,
            ..p2p::protocol::Config::from(
                self.config.name,
                self.config.network,
                self.config.connect,
            )
        };
        log::info!("Initializing client ({:?})..", cfg.network);
        log::info!("Genesis block hash is {}", cfg.network.genesis_hash());
        log::info!("Chain height is {}", cache.height());
        let local_time = SystemTime::now().into();
        let clock = AdjustedTime::<net::SocketAddr>::new(local_time);
        let rng = fastrand::Rng::new();
        log::info!("{} peer(s) found..", peers.len());
        self.reactor.on_event({
            let blocks = self.blocks;
            let filters = self.filters;
            move |event| Self::process_event(event, blocks.clone(), filters.clone())
        });
        self.reactor.run(&self.config.listen, |upstream| {
            Protocol::new(cache, filters, peers, clock, rng, cfg, upstream)
        })?;
        Ok(())
    }
pub fn run_with < T : BlockTree , F : Filters , P : peer :: Store > ( mut self , cache : T , filters : F , peers : P , ) -> Result < ( ) , Error > { let cfg = p2p :: protocol :: Config { services : self . config . services , .. p2p :: protocol :: Config :: from ( self . config . name , self . config . network , self . config . connect , ) } ; log :: info ! ( " " cfg network ) ; log :: info ! ( " " cfg network genesis_hash ( ) ) ; log :: info ! ( " " cache height ( ) ) ; let local_time = SystemTime :: now ( ) . into ( ) ; let clock = AdjustedTime :: < net :: SocketAddr > :: new ( local_time ) ; let rng = fastrand :: Rng :: new ( ) ; log :: info ! ( " " peers len ( ) ) ; self . reactor . on_event ( { let blocks = self . blocks ; let filters = self . filters ; move | event | Self :: process_event ( event , blocks . clone ( ) , filters . clone ( ) ) } ) ; self . reactor . run ( & self . config . listen , | upstream | { Protocol :: new ( cache , filters , peers , clock , rng , cfg , upstream ) } ) ? ; Ok ( ( ) ) }
Start the client process, supplying the block cache.
Start the client process supplying the block cache .
mut self
cache
T
filters
F
peers
P