fn add_vertex(
        &mut self,
        rng: &mut NodeRng,
        recipient: ValidatorId,
        sender: ValidatorId,
        vertex: Vertex<TestContext>,
        delivery_time: Timestamp,
    ) -> TestRunResult<Vec<HighwayMessage>> {
        // 1. pre_validate_vertex
        // 2. missing_dependency
        // 3. validate_vertex
        // 4. add_valid_vertex

        let sync_result = {
            let validator = self.node_mut(&recipient)?;

            match validator
                .validator_mut()
                .highway_mut()
                .pre_validate_vertex(vertex)
            {
                Err((v, error)) => Ok(Err((v, error))),
                Ok(pvv) => self.synchronize_validator(rng, recipient, sender, pvv, delivery_time),
            }
        }?;

        match sync_result {
            Err(vertex_error) => Ok(Err(vertex_error)),
            Ok((prevalidated_vertex, mut sync_effects)) => {
                let add_vertex_effects: Vec<HighwayMessage> = {
                    match self
                        .node_mut(&recipient)?
                        .validator_mut()
                        .highway_mut()
                        .validate_vertex(prevalidated_vertex)
                    {
                        Err((pvv, error)) => return Ok(Err((pvv.into_vertex(), error))),
                        Ok(valid_vertex) => {
                            self.call_validator(delivery_time, &recipient, |v| {
                                v.highway_mut()
                                    .add_valid_vertex(valid_vertex, delivery_time)
                            })?
                        }
                    }
                };

                sync_effects.extend(add_vertex_effects);

                Ok(Ok(sync_effects))
            }
        }
    }
// Adds vertex to the `recipient` validator state.
// Synchronizes its state if necessary.
// From the POV of the test system, synchronization is immediate.
Adds vertex to the `recipient` validator state.
Synchronizes its state if necessary.
From the POV of the test system, synchronization is immediate.
Adds vertex to the ` recipient ` validator state . Synchronizes its state if necessary . From the POV of the test system synchronization is immediate .
fn add_vertex(
        &mut self,
        rng: &mut NodeRng,
        recipient: ValidatorId,
        sender: ValidatorId,
        vertex: Vertex<TestContext>,
        delivery_time: Timestamp,
    ) -> TestRunResult<Vec<HighwayMessage>> {
        // 1. pre_validate_vertex
        // 2. missing_dependency
        // 3. validate_vertex
        // 4. add_valid_vertex
        let sync_result = {
            let validator = self.node_mut(&recipient)?;
            match validator
                .validator_mut()
                .highway_mut()
                .pre_validate_vertex(vertex)
            {
                Err((v, error)) => Ok(Err((v, error))),
                Ok(pvv) => self.synchronize_validator(rng, recipient, sender, pvv, delivery_time),
            }
        }?;
        match sync_result {
            Err(vertex_error) => Ok(Err(vertex_error)),
            Ok((prevalidated_vertex, mut sync_effects)) => {
                let add_vertex_effects: Vec<HighwayMessage> = {
                    match self
                        .node_mut(&recipient)?
                        .validator_mut()
                        .highway_mut()
                        .validate_vertex(prevalidated_vertex)
                    {
                        Err((pvv, error)) => return Ok(Err((pvv.into_vertex(), error))),
                        Ok(valid_vertex) => {
                            self.call_validator(delivery_time, &recipient, |v| {
                                v.highway_mut()
                                    .add_valid_vertex(valid_vertex, delivery_time)
                            })?
                        }
                    }
                };
                sync_effects.extend(add_vertex_effects);
                Ok(Ok(sync_effects))
            }
        }
    }
fn add_vertex ( & mut self , rng : & mut NodeRng , recipient : ValidatorId , sender : ValidatorId , vertex : Vertex < TestContext > , delivery_time : Timestamp , ) -> TestRunResult < Vec < HighwayMessage > > { // 1. pre_validate_vertex // 2. missing_dependency // 3. validate_vertex // 4. add_valid_vertex let sync_result = { let validator = self . node_mut ( & recipient ) ? ; match validator . validator_mut ( ) . highway_mut ( ) . pre_validate_vertex ( vertex ) { Err ( ( v , error ) ) => Ok ( Err ( ( v , error ) ) ) , Ok ( pvv ) => self . synchronize_validator ( rng , recipient , sender , pvv , delivery_time ) , } } ? ; match sync_result { Err ( vertex_error ) => Ok ( Err ( vertex_error ) ) , Ok ( ( prevalidated_vertex , mut sync_effects ) ) => { let add_vertex_effects : Vec < HighwayMessage > = { match self . node_mut ( & recipient ) ? . validator_mut ( ) . highway_mut ( ) . validate_vertex ( prevalidated_vertex ) { Err ( ( pvv , error ) ) => return Ok ( Err ( ( pvv . into_vertex ( ) , error ) ) ) , Ok ( valid_vertex ) => { self . call_validator ( delivery_time , & recipient , | v | { v . highway_mut ( ) . add_valid_vertex ( valid_vertex , delivery_time ) } ) ? } } } ; sync_effects . extend ( add_vertex_effects ) ; Ok ( Ok ( sync_effects ) ) } } }
Adds vertex to the `recipient` validator state.
Adds vertex to the ` recipient ` validator state .
&mut self
rng
&mut NodeRng
recipient
ValidatorId
sender
ValidatorId
vertex
Vertex<TestContext>
delivery_time
Timestamp
&mut self
rng
&mut NodeRng
recipient
ValidatorId
sender
ValidatorId
vertex
Vertex<TestContext>
delivery_time
Timestamp