pub(crate) fn crank(&mut self, rng: &mut NodeRng) -> TestResult<()> {
        let QueueEntry {
            delivery_time,
            recipient,
            message,
        } = self
            .virtual_net
            .pop_message()
            .ok_or(TestRunError::NoMessages)?;

        let span = tracing::trace_span!("crank", validator = %recipient);
        let _enter = span.enter();
        trace!(
            "Processing: tick {}, sender validator={}, payload {:?}",
            delivery_time,
            message.sender,
            message.payload(),
        );

        let messages = self.process_message(rng, recipient, message, delivery_time)?;

        let targeted_messages = messages
            .into_iter()
            .filter_map(|hwm| {
                let delivery = self.delivery_time_strategy.gen_delay(
                    rng,
                    &hwm,
                    &self.delivery_time_distribution,
                    delivery_time,
                );
                match delivery {
                    DeliverySchedule::Drop => {
                        trace!("{:?} message is dropped.", hwm);
                        None
                    }
                    DeliverySchedule::AtInstant(timestamp) => {
                        trace!("{:?} scheduled for {:?}", hwm, timestamp);
                        let targeted = hwm.into_targeted(recipient);
                        Some((targeted, timestamp))
                    }
                }
            })
            .collect();

        self.virtual_net.dispatch_messages(targeted_messages);
        Ok(())
    }
/// Advance the test by one message.
///
/// Pops one message from the message queue (if there are any)
/// and pass it to the recipient validator for execution.
/// Messages returned from the execution are scheduled for later delivery.
Advance the test by one message.
Pops one message from the message queue (if there are any)
and pass it to the recipient validator for execution.
Messages returned from the execution are scheduled for later delivery.
Advance the test by one message . Pops one message from the message queue ( if there are any ) and pass it to the recipient validator for execution . Messages returned from the execution are scheduled for later delivery .
pub(crate) fn crank(&mut self, rng: &mut NodeRng) -> TestResult<()> {
        let QueueEntry {
            delivery_time,
            recipient,
            message,
        } = self
            .virtual_net
            .pop_message()
            .ok_or(TestRunError::NoMessages)?;
        let span = tracing::trace_span!("crank", validator = %recipient);
        let _enter = span.enter();
        trace!(
            "Processing: tick {}, sender validator={}, payload {:?}",
            delivery_time,
            message.sender,
            message.payload(),
        );
        let messages = self.process_message(rng, recipient, message, delivery_time)?;
        let targeted_messages = messages
            .into_iter()
            .filter_map(|hwm| {
                let delivery = self.delivery_time_strategy.gen_delay(
                    rng,
                    &hwm,
                    &self.delivery_time_distribution,
                    delivery_time,
                );
                match delivery {
                    DeliverySchedule::Drop => {
                        trace!("{:?} message is dropped.", hwm);
                        None
                    }
                    DeliverySchedule::AtInstant(timestamp) => {
                        trace!("{:?} scheduled for {:?}", hwm, timestamp);
                        let targeted = hwm.into_targeted(recipient);
                        Some((targeted, timestamp))
                    }
                }
            })
            .collect();
        self.virtual_net.dispatch_messages(targeted_messages);
        Ok(())
    }
pub ( crate ) fn crank ( & mut self , rng : & mut NodeRng ) -> TestResult < ( ) > { let QueueEntry { delivery_time , recipient , message , } = self . virtual_net . pop_message ( ) . ok_or ( TestRunError :: NoMessages ) ? ; let span = tracing :: trace_span ! ( " " validator recipient ) ; let _enter = span . enter ( ) ; trace ! ( " " delivery_time message sender message payload ( ) ) ; let messages = self . process_message ( rng , recipient , message , delivery_time ) ? ; let targeted_messages = messages . into_iter ( ) . filter_map ( | hwm | { let delivery = self . delivery_time_strategy . gen_delay ( rng , & hwm , & self . delivery_time_distribution , delivery_time , ) ; match delivery { DeliverySchedule :: Drop => { trace ! ( " " hwm ) ; None } DeliverySchedule :: AtInstant ( timestamp ) => { trace ! ( " " hwm timestamp ) ; let targeted = hwm . into_targeted ( recipient ) ; Some ( ( targeted , timestamp ) ) } } } ) . collect ( ) ; self . virtual_net . dispatch_messages ( targeted_messages ) ; Ok ( ( ) ) }
Advance the test by one message.
Advance the test by one message .
&mut self
rng
&mut NodeRng
&mut self
rng
&mut NodeRng