fn process_message(
        &mut self,
        rng: &mut NodeRng,
        validator_id: ValidatorId,
        message: Message<HighwayMessage>,
        delivery_time: Timestamp,
    ) -> TestResult<Vec<HighwayMessage>> {
        self.node_mut(&validator_id)?
            .push_messages_received(vec![message.clone()]);

        let messages = {
            let sender_id = message.sender;

            let hwm = message.payload().clone();

            match hwm {
                HighwayMessage::Timer(timestamp) => {
                    self.call_validator(delivery_time, &validator_id, |consensus| {
                        consensus.highway_mut().handle_timer(timestamp)
                    })?
                }
                HighwayMessage::NewVertex(v) => {
                    match self.add_vertex(
                        rng,
                        validator_id,
                        sender_id,
                        *v.clone(),
                        delivery_time,
                    )? {
                        Ok(msgs) => {
                            trace!("{:?} successfully added to the state.", v);
                            msgs
                        }
                        Err((v, error)) => {
                            // TODO: this seems to get output from passing tests
                            warn!(
                                "{:?} sent an invalid vertex {:?} to {:?} \
                                that resulted in {:?} error",
                                sender_id, v, validator_id, error
                            );
                            vec![]
                        }
                    }
                }
                HighwayMessage::RequestBlock(block_context) => {
                    let consensus_value = self.next_consensus_value(block_context.height());

                    self.call_validator(delivery_time, &validator_id, |consensus| {
                        consensus
                            .highway_mut()
                            .propose(consensus_value, block_context)
                    })?
                }
                HighwayMessage::WeAreFaulty(_evidence) => vec![],
            }
        };

        let recipient = self.node_mut(&validator_id)?;
        recipient.push_messages_produced(messages.clone());

        self.run_finality_detector(&validator_id)?;

        Ok(messages)
    }
/// Processes a message sent to `validator_id`.
/// Returns a vector of messages produced by the `validator` in reaction to processing a
/// message.
Processes a message sent to `validator_id`.
Returns a vector of messages produced by the `validator` in reaction to processing a
message.
Processes a message sent to ` validator_id ` . Returns a vector of messages produced by the ` validator ` in reaction to processing a message .
fn process_message(
        &mut self,
        rng: &mut NodeRng,
        validator_id: ValidatorId,
        message: Message<HighwayMessage>,
        delivery_time: Timestamp,
    ) -> TestResult<Vec<HighwayMessage>> {
        self.node_mut(&validator_id)?
            .push_messages_received(vec![message.clone()]);
        let messages = {
            let sender_id = message.sender;
            let hwm = message.payload().clone();
            match hwm {
                HighwayMessage::Timer(timestamp) => {
                    self.call_validator(delivery_time, &validator_id, |consensus| {
                        consensus.highway_mut().handle_timer(timestamp)
                    })?
                }
                HighwayMessage::NewVertex(v) => {
                    match self.add_vertex(
                        rng,
                        validator_id,
                        sender_id,
                        *v.clone(),
                        delivery_time,
                    )? {
                        Ok(msgs) => {
                            trace!("{:?} successfully added to the state.", v);
                            msgs
                        }
                        Err((v, error)) => {
                            // TODO: this seems to get output from passing tests
                            warn!(
                                "{:?} sent an invalid vertex {:?} to {:?} \
                                that resulted in {:?} error",
                                sender_id, v, validator_id, error
                            );
                            vec![]
                        }
                    }
                }
                HighwayMessage::RequestBlock(block_context) => {
                    let consensus_value = self.next_consensus_value(block_context.height());
                    self.call_validator(delivery_time, &validator_id, |consensus| {
                        consensus
                            .highway_mut()
                            .propose(consensus_value, block_context)
                    })?
                }
                HighwayMessage::WeAreFaulty(_evidence) => vec![],
            }
        };
        let recipient = self.node_mut(&validator_id)?;
        recipient.push_messages_produced(messages.clone());
        self.run_finality_detector(&validator_id)?;
        Ok(messages)
    }
fn process_message ( & mut self , rng : & mut NodeRng , validator_id : ValidatorId , message : Message < HighwayMessage > , delivery_time : Timestamp , ) -> TestResult < Vec < HighwayMessage > > { self . node_mut ( & validator_id ) ? . push_messages_received ( vec ! [ message clone ( ) ] ) ; let messages = { let sender_id = message . sender ; let hwm = message . payload ( ) . clone ( ) ; match hwm { HighwayMessage :: Timer ( timestamp ) => { self . call_validator ( delivery_time , & validator_id , | consensus | { consensus . highway_mut ( ) . handle_timer ( timestamp ) } ) ? } HighwayMessage :: NewVertex ( v ) => { match self . add_vertex ( rng , validator_id , sender_id , * v . clone ( ) , delivery_time , ) ? { Ok ( msgs ) => { trace ! ( " " v ) ; msgs } Err ( ( v , error ) ) => { // TODO: this seems to get output from passing tests warn ! ( " \
 " sender_id v validator_id error ) ; vec ! [ ] } } } HighwayMessage :: RequestBlock ( block_context ) => { let consensus_value = self . next_consensus_value ( block_context . height ( ) ) ; self . call_validator ( delivery_time , & validator_id , | consensus | { consensus . highway_mut ( ) . propose ( consensus_value , block_context ) } ) ? } HighwayMessage :: WeAreFaulty ( _evidence ) => vec ! [ ] , } } ; let recipient = self . node_mut ( & validator_id ) ? ; recipient . push_messages_produced ( messages . clone ( ) ) ; self . run_finality_detector ( & validator_id ) ? ; Ok ( messages ) }
Processes a message sent to `validator_id`.
Processes a message sent to ` validator_id ` .
&mut self
rng
&mut NodeRng
validator_id
ValidatorId
message
Message<HighwayMessage>
delivery_time
Timestamp
&mut self
rng
&mut NodeRng
validator_id
ValidatorId
message
Message<HighwayMessage>
delivery_time
Timestamp