/// Add a new consensus instance using the given NodeId, default
/// configuration, NodeId and ConsensusDependencies.
///
/// The NodeId and ConsensusDependencies should be different for each
/// instance.
Add a new consensus instance using the given NodeId, default
configuration, NodeId and ConsensusDependencies.

The NodeId and ConsensusDependencies should be different for each
instance.
Add a new consensus instance using the given NodeId default configuration NodeId and ConsensusDependencies . The NodeId and ConsensusDependencies should be different for each instance .
pub fn add_instance(
        &mut self,
        membership: Arc<Membership>,
        fake_crypto: Arc<CryptoReturningOk>,
        deps: &'a ConsensusDependencies,
        pool_config: ArtifactPoolConfig,
    ) {
        let node_id = deps.replica_config.node_id;
        let mut context = self.logger.get_context();
        context.node_id = format!("{}", node_id.get());
        let replica_logger = self.logger.with_new_context(context);
        let dkg_key_manager = Arc::new(Mutex::new(DkgKeyManager::new(
            deps.metrics_registry.clone(),
            Arc::clone(&fake_crypto) as Arc<_>,
            replica_logger.clone(),
        )));
        let consensus = ConsensusImpl::new(
            deps.replica_config.clone(),
            Default::default(),
            Arc::clone(&deps.registry_client),
            membership.clone(),
            fake_crypto.clone(),
            deps.ingress_selector.clone(),
            deps.xnet_payload_builder.clone(),
            deps.self_validating_payload_builder.clone(),
            deps.dkg_pool.clone(),
            deps.ecdsa_pool.clone(),
            dkg_key_manager.clone(),
            deps.message_routing.clone(),
            deps.state_manager.clone(),
            Arc::clone(&self.time) as Arc<_>,
            Duration::from_secs(0),
            MaliciousFlags::default(),
            deps.metrics_registry.clone(),
            replica_logger.clone(),
            None,
        );
        let dkg = dkg::DkgImpl::new(
            deps.replica_config.node_id,
            fake_crypto.clone(),
            deps.consensus_pool.read().unwrap().get_cache(),
            dkg_key_manager,
            deps.metrics_registry.clone(),
            replica_logger.clone(),
        );
        let certifier = CertifierImpl::new(
            deps.replica_config.clone(),
            membership,
            fake_crypto,
            deps.state_manager.clone(),
            deps.metrics_registry.clone(),
            replica_logger.clone(),
        );
        let now = self.time.get_relative_time();
        let in_queue: Queue<Input> = Default::default();
        // Initial in_queue needs something to kickstart
        in_queue.borrow_mut().push(Input::TimerExpired(now));
        self.instances.push(ConsensusInstance {
            node_id,
            deps,
            in_queue,
            out_queue: Default::default(),
            driver: ConsensusDriver::new(
                pool_config,
                consensus,
                dkg,
                Box::new(certifier),
                deps.consensus_pool.clone(),
                deps.dkg_pool.clone(),
                replica_logger,
                deps.metrics_registry.clone(),
            ),
            clock: RefCell::new(now),
            index: self.instances.len(),
        });
    }
pub fn add_instance ( & mut self , membership : Arc < Membership > , fake_crypto : Arc < CryptoReturningOk > , deps : & ' a ConsensusDependencies , pool_config : ArtifactPoolConfig , ) { let node_id = deps . replica_config . node_id ; let mut context = self . logger . get_context ( ) ; context . node_id = format ! ( " " node_id get ( ) ) ; let replica_logger = self . logger . with_new_context ( context ) ; let dkg_key_manager = Arc :: new ( Mutex :: new ( DkgKeyManager :: new ( deps . metrics_registry . clone ( ) , Arc :: clone ( & fake_crypto ) as Arc < _ > , replica_logger . clone ( ) , ) ) ) ; let consensus = ConsensusImpl :: new ( deps . replica_config . clone ( ) , Default :: default ( ) , Arc :: clone ( & deps . registry_client ) , membership . clone ( ) , fake_crypto . clone ( ) , deps . ingress_selector . clone ( ) , deps . xnet_payload_builder . clone ( ) , deps . self_validating_payload_builder . clone ( ) , deps . dkg_pool . clone ( ) , deps . ecdsa_pool . clone ( ) , dkg_key_manager . clone ( ) , deps . message_routing . clone ( ) , deps . state_manager . clone ( ) , Arc :: clone ( & self . time ) as Arc < _ > , Duration :: from_secs ( 0 ) , MaliciousFlags :: default ( ) , deps . metrics_registry . clone ( ) , replica_logger . clone ( ) , None , ) ; let dkg = dkg :: DkgImpl :: new ( deps . replica_config . node_id , fake_crypto . clone ( ) , deps . consensus_pool . read ( ) . unwrap ( ) . get_cache ( ) , dkg_key_manager , deps . metrics_registry . clone ( ) , replica_logger . clone ( ) , ) ; let certifier = CertifierImpl :: new ( deps . replica_config . clone ( ) , membership , fake_crypto , deps . state_manager . clone ( ) , deps . metrics_registry . clone ( ) , replica_logger . clone ( ) , ) ; let now = self . time . get_relative_time ( ) ; let in_queue : Queue < Input > = Default :: default ( ) ; // Initial in_queue needs something to kickstart in_queue . borrow_mut ( ) . push ( Input :: TimerExpired ( now ) ) ; self . instances . push ( ConsensusInstance { node_id , deps , in_queue , out_queue : Default :: default ( ) , driver : ConsensusDriver :: new ( pool_config , consensus , dkg , Box :: new ( certifier ) , deps . consensus_pool . clone ( ) , deps . dkg_pool . clone ( ) , replica_logger , deps . metrics_registry . clone ( ) , ) , clock : RefCell :: new ( now ) , index : self . instances . len ( ) , } ) ; }
Add a new consensus instance using the given NodeId, default
configuration, NodeId and ConsensusDependencies.
Add a new consensus instance using the given NodeId default configuration NodeId and ConsensusDependencies .
&mut self
membership
Arc<Membership>
fake_crypto
Arc<CryptoReturningOk>
deps
&'a ConsensusDependencies
pool_config
ArtifactPoolConfig