pub fn replay<F: FnMut(&Player, Time) -> Vec<SignedIngress>>(&self, extra: F) {
        if let (Some(consensus_pool), Some(certification_pool)) =
            (&self.consensus_pool, &self.certification_pool)
        {
            let pool_reader = &PoolReader::new(consensus_pool);
            let finalized_height = pool_reader.get_finalized_height();
            let target_height = Some(
                finalized_height.min(
                    self.replay_target_height
                        .map(Height::from)
                        .unwrap_or_else(|| finalized_height),
                ),
            );
            let last_batch_height =
                self.deliver_batches(&self.message_routing, pool_reader, target_height);
            self.wait_for_state(last_batch_height);
            // We only want to persist the checkpoint after the latest batch.
            self.state_manager.remove_states_below(last_batch_height);

            // Redeliver certifications to state manager. It will panic if there is any
            // mismatch.
            for h in certification_pool.certified_heights() {
                let certification = certification_pool
                    .certification_at_height(h)
                    .unwrap_or_else(|| panic!("Missing certification at height {:?}", h));
                self.state_manager
                    .deliver_state_certification(certification);
            }
        }

        let (latest_context_time, extra_batch_delivery) =
            self.deliver_extra_batch(&self.message_routing, self.consensus_pool.as_ref(), extra);

        if let Some((last_batch_height, msg_ids)) = extra_batch_delivery {
            self.wait_for_state(last_batch_height);
            // We only want to persist the checkpoint after the latest batch.
            self.state_manager.remove_states_below(last_batch_height);

            // check if the extra messages have been delivered successfully
            let get_latest_status = self.ingress_history_reader.get_latest_status();
            for msg_id in msg_ids {
                match get_latest_status(&msg_id) {
                    IngressStatus::Completed {
                        result: WasmResult::Reply(bytes),
                        ..
                    } => println!("Ingress id={} response={}", &msg_id, hex::encode(bytes)),
                    status => panic!("Execution of {} has failed: {:?}", msg_id, status),
                }
            }
        }

        // If we are not replaying NNS subnet, this query will fail.
        // If it fails, we'll query registry client for latest version instead.
        let registry_version = self
            .get_latest_registry_version(latest_context_time)
            .unwrap_or_else(|_| self.registry.get_latest_version());
        println!("Latest registry version: {}", registry_version);
    }
/// Replay past finalized but un-executed blocks by delivering ingress
/// messages for execution, and make a full checkpoint of the latest
/// state when they all finish.
///
/// It takes a function argument, which can be used to make extra ingress
/// messages for execution, which are delivered after the last finalized
/// block has been replayed. Note that this will advance the executed
/// batch height but not advance finalized block height in consensus
/// pool.
Replay past finalized but un-executed blocks by delivering ingress
messages for execution, and make a full checkpoint of the latest
state when they all finish.

It takes a function argument, which can be used to make extra ingress
messages for execution, which are delivered after the last finalized
block has been replayed. Note that this will advance the executed
batch height but not advance finalized block height in consensus
pool.
Replay past finalized but un - executed blocks by delivering ingress messages for execution and make a full checkpoint of the latest state when they all finish . It takes a function argument which can be used to make extra ingress messages for execution which are delivered after the last finalized block has been replayed . Note that this will advance the executed batch height but not advance finalized block height in consensus pool .
pub fn replay<F: FnMut(&Player, Time) -> Vec<SignedIngress>>(&self, extra: F) {
        if let (Some(consensus_pool), Some(certification_pool)) =
            (&self.consensus_pool, &self.certification_pool)
        {
            let pool_reader = &PoolReader::new(consensus_pool);
            let finalized_height = pool_reader.get_finalized_height();
            let target_height = Some(
                finalized_height.min(
                    self.replay_target_height
                        .map(Height::from)
                        .unwrap_or_else(|| finalized_height),
                ),
            );
            let last_batch_height =
                self.deliver_batches(&self.message_routing, pool_reader, target_height);
            self.wait_for_state(last_batch_height);
            // We only want to persist the checkpoint after the latest batch.
            self.state_manager.remove_states_below(last_batch_height);
            // Redeliver certifications to state manager. It will panic if there is any
            // mismatch.
            for h in certification_pool.certified_heights() {
                let certification = certification_pool
                    .certification_at_height(h)
                    .unwrap_or_else(|| panic!("Missing certification at height {:?}", h));
                self.state_manager
                    .deliver_state_certification(certification);
            }
        }
        let (latest_context_time, extra_batch_delivery) =
            self.deliver_extra_batch(&self.message_routing, self.consensus_pool.as_ref(), extra);
        if let Some((last_batch_height, msg_ids)) = extra_batch_delivery {
            self.wait_for_state(last_batch_height);
            // We only want to persist the checkpoint after the latest batch.
            self.state_manager.remove_states_below(last_batch_height);
            // check if the extra messages have been delivered successfully
            let get_latest_status = self.ingress_history_reader.get_latest_status();
            for msg_id in msg_ids {
                match get_latest_status(&msg_id) {
                    IngressStatus::Completed {
                        result: WasmResult::Reply(bytes),
                        ..
                    } => println!("Ingress id={} response={}", &msg_id, hex::encode(bytes)),
                    status => panic!("Execution of {} has failed: {:?}", msg_id, status),
                }
            }
        }
        // If we are not replaying NNS subnet, this query will fail.
        // If it fails, we'll query registry client for latest version instead.
        let registry_version = self
            .get_latest_registry_version(latest_context_time)
            .unwrap_or_else(|_| self.registry.get_latest_version());
        println!("Latest registry version: {}", registry_version);
    }
pub fn replay < F : FnMut ( & Player , Time ) -> Vec < SignedIngress > > ( & self , extra : F ) { if let ( Some ( consensus_pool ) , Some ( certification_pool ) ) = ( & self . consensus_pool , & self . certification_pool ) { let pool_reader = & PoolReader :: new ( consensus_pool ) ; let finalized_height = pool_reader . get_finalized_height ( ) ; let target_height = Some ( finalized_height . min ( self . replay_target_height . map ( Height :: from ) . unwrap_or_else ( | | finalized_height ) , ) , ) ; let last_batch_height = self . deliver_batches ( & self . message_routing , pool_reader , target_height ) ; self . wait_for_state ( last_batch_height ) ; // We only want to persist the checkpoint after the latest batch. self . state_manager . remove_states_below ( last_batch_height ) ; // Redeliver certifications to state manager. It will panic if there is any // mismatch. for h in certification_pool . certified_heights ( ) { let certification = certification_pool . certification_at_height ( h ) . unwrap_or_else ( | | panic ! ( " " h ) ) ; self . state_manager . deliver_state_certification ( certification ) ; } } let ( latest_context_time , extra_batch_delivery ) = self . deliver_extra_batch ( & self . message_routing , self . consensus_pool . as_ref ( ) , extra ) ; if let Some ( ( last_batch_height , msg_ids ) ) = extra_batch_delivery { self . wait_for_state ( last_batch_height ) ; // We only want to persist the checkpoint after the latest batch. self . state_manager . remove_states_below ( last_batch_height ) ; // check if the extra messages have been delivered successfully let get_latest_status = self . ingress_history_reader . get_latest_status ( ) ; for msg_id in msg_ids { match get_latest_status ( & msg_id ) { IngressStatus :: Completed { result : WasmResult :: Reply ( bytes ) , .. } => println ! ( " " msg_id hex encode ( bytes ) ) , status => panic ! ( " " msg_id status ) , } } } // If we are not replaying NNS subnet, this query will fail. // If it fails, we'll query registry client for latest version instead. let registry_version = self . get_latest_registry_version ( latest_context_time ) . unwrap_or_else ( | _ | self . registry . get_latest_version ( ) ) ; println ! ( " " registry_version ) ; }
Replay past finalized but un-executed blocks by delivering ingress
messages for execution, and make a full checkpoint of the latest
state when they all finish.
Replay past finalized but un - executed blocks by delivering ingress messages for execution and make a full checkpoint of the latest state when they all finish .
&self
extra
F
&self
extra
F