fn accept<REv: ReactorEventT>(
        &mut self,
        effect_builder: EffectBuilder<REv>,
        deploy: Box<Deploy>,
        source: Source<NodeId>,
        maybe_responder: Option<Responder<Result<(), Error>>>,
    ) -> Effects<Event> {
        let verification_start_timestamp = Timestamp::now();
        let acceptable_result = deploy.is_config_compliant(
            &self.chain_name,
            &self.deploy_config,
            self.max_associated_keys,
        );
        // checks chainspec values
        // DOES NOT check cryptographic security
        if let Err(error) = acceptable_result {
            debug!(%deploy, %error, "deploy is incorrectly configured");
            return self.handle_invalid_deploy_result(
                effect_builder,
                EventMetadata::new(deploy, source, maybe_responder),
                Error::InvalidDeployConfiguration(error),
                verification_start_timestamp,
            );
        }

        // We only perform expiry checks on deploys received from the client.
        if source.from_client() {
            let current_node_timestamp = Timestamp::now();
            if deploy.header().expired(current_node_timestamp) {
                let time_of_expiry = deploy.header().expires();
                debug!(%deploy, "deploy has expired");
                return self.handle_invalid_deploy_result(
                    effect_builder,
                    EventMetadata::new(deploy, source, maybe_responder),
                    Error::ExpiredDeploy {
                        deploy_expiry_timestamp: time_of_expiry,
                        current_node_timestamp,
                    },
                    verification_start_timestamp,
                );
            }
        }

        if self.verify_accounts {
            effect_builder
                .get_highest_block_from_storage()
                .event(move |maybe_block| Event::GetBlockResult {
                    event_metadata: EventMetadata::new(deploy, source, maybe_responder),
                    maybe_block: Box::new(maybe_block),
                    verification_start_timestamp,
                })
        } else {
            effect_builder
                .immediately()
                .event(move |_| Event::VerifyDeployCryptographicValidity {
                    event_metadata: EventMetadata::new(deploy, source, maybe_responder),
                    verification_start_timestamp,
                })
        }
    }
/// Handles receiving a new `Deploy` from a peer or client.
/// In the case of a peer, there should be no responder and the variant should be `None`
/// In the case of a client, there should be a responder to communicate the validity of the
/// deploy and the variant will be `Some`
Handles receiving a new `Deploy` from a peer or client.
In the case of a peer, there should be no responder and the variant should be `None`
In the case of a client, there should be a responder to communicate the validity of the
deploy and the variant will be `Some`
Handles receiving a new ` Deploy ` from a peer or client . In the case of a peer there should be no responder and the variant should be ` None ` In the case of a client there should be a responder to communicate the validity of the deploy and the variant will be ` Some `
fn accept<REv: ReactorEventT>(
        &mut self,
        effect_builder: EffectBuilder<REv>,
        deploy: Box<Deploy>,
        source: Source<NodeId>,
        maybe_responder: Option<Responder<Result<(), Error>>>,
    ) -> Effects<Event> {
        let verification_start_timestamp = Timestamp::now();
        let acceptable_result = deploy.is_config_compliant(
            &self.chain_name,
            &self.deploy_config,
            self.max_associated_keys,
        );
        // checks chainspec values
        // DOES NOT check cryptographic security
        if let Err(error) = acceptable_result {
            debug!(%deploy, %error, "deploy is incorrectly configured");
            return self.handle_invalid_deploy_result(
                effect_builder,
                EventMetadata::new(deploy, source, maybe_responder),
                Error::InvalidDeployConfiguration(error),
                verification_start_timestamp,
            );
        }
        // We only perform expiry checks on deploys received from the client.
        if source.from_client() {
            let current_node_timestamp = Timestamp::now();
            if deploy.header().expired(current_node_timestamp) {
                let time_of_expiry = deploy.header().expires();
                debug!(%deploy, "deploy has expired");
                return self.handle_invalid_deploy_result(
                    effect_builder,
                    EventMetadata::new(deploy, source, maybe_responder),
                    Error::ExpiredDeploy {
                        deploy_expiry_timestamp: time_of_expiry,
                        current_node_timestamp,
                    },
                    verification_start_timestamp,
                );
            }
        }
        if self.verify_accounts {
            effect_builder
                .get_highest_block_from_storage()
                .event(move |maybe_block| Event::GetBlockResult {
                    event_metadata: EventMetadata::new(deploy, source, maybe_responder),
                    maybe_block: Box::new(maybe_block),
                    verification_start_timestamp,
                })
        } else {
            effect_builder
                .immediately()
                .event(move |_| Event::VerifyDeployCryptographicValidity {
                    event_metadata: EventMetadata::new(deploy, source, maybe_responder),
                    verification_start_timestamp,
                })
        }
    }
fn accept < REv : ReactorEventT > ( & mut self , effect_builder : EffectBuilder < REv > , deploy : Box < Deploy > , source : Source < NodeId > , maybe_responder : Option < Responder < Result < ( ) , Error > > > , ) -> Effects < Event > { let verification_start_timestamp = Timestamp :: now ( ) ; let acceptable_result = deploy . is_config_compliant ( & self . chain_name , & self . deploy_config , self . max_associated_keys , ) ; // checks chainspec values // DOES NOT check cryptographic security if let Err ( error ) = acceptable_result { debug ! ( deploy error " " ) ; return self . handle_invalid_deploy_result ( effect_builder , EventMetadata :: new ( deploy , source , maybe_responder ) , Error :: InvalidDeployConfiguration ( error ) , verification_start_timestamp , ) ; } // We only perform expiry checks on deploys received from the client. if source . from_client ( ) { let current_node_timestamp = Timestamp :: now ( ) ; if deploy . header ( ) . expired ( current_node_timestamp ) { let time_of_expiry = deploy . header ( ) . expires ( ) ; debug ! ( deploy " " ) ; return self . handle_invalid_deploy_result ( effect_builder , EventMetadata :: new ( deploy , source , maybe_responder ) , Error :: ExpiredDeploy { deploy_expiry_timestamp : time_of_expiry , current_node_timestamp , } , verification_start_timestamp , ) ; } } if self . verify_accounts { effect_builder . get_highest_block_from_storage ( ) . event ( move | maybe_block | Event :: GetBlockResult { event_metadata : EventMetadata :: new ( deploy , source , maybe_responder ) , maybe_block : Box :: new ( maybe_block ) , verification_start_timestamp , } ) } else { effect_builder . immediately ( ) . event ( move | _ | Event :: VerifyDeployCryptographicValidity { event_metadata : EventMetadata :: new ( deploy , source , maybe_responder ) , verification_start_timestamp , } ) } }
Handles receiving a new `Deploy` from a peer or client.
Handles receiving a new ` Deploy ` from a peer or client .
&mut self
effect_builder
EffectBuilder<REv>
deploy
Box<Deploy>
source
Source<NodeId>
maybe_responder
Option<Responder<Result<(), Error>>>
&mut self
effect_builder
EffectBuilder<REv>
deploy
Box<Deploy>
source
Source<NodeId>
maybe_responder
Option<Responder<Result<(), Error>>>