fn fetch_deploy<REv, I>(
    effect_builder: EffectBuilder<REv>,
    dt_hash: DeployOrTransferHash,
    sender: I,
) -> Effects<Event<I>>
where
    REv: From<Event<I>>
        + From<BlockValidationRequest<I>>
        + From<StorageRequest>
        + From<FetcherRequest<I, Deploy>>
        + Send,
    I: Clone + Send + PartialEq + Eq + 'static,
{
    let validate_deploy = move |result: FetchResult<Deploy, I>| match result {
        FetchResult::FromStorage(deploy) | FetchResult::FromPeer(deploy, _) => {
            (deploy.deploy_or_transfer_hash() == dt_hash)
                .then(|| deploy)
                .and_then(|deploy| deploy.deploy_info().ok())
                .map_or(Event::CannotConvertDeploy(dt_hash), |deploy_info| {
                    Event::DeployFound {
                        dt_hash,
                        deploy_info: Box::new(deploy_info),
                    }
                })
        }
    };

    effect_builder
        .fetch_deploy(dt_hash.into(), sender)
        .map_or_else(validate_deploy, move || Event::DeployMissing(dt_hash))
}
/// Returns effects that fetch the deploy and validate it.
Returns effects that fetch the deploy and validate it.
Returns effects that fetch the deploy and validate it .
fn fetch_deploy<REv, I>(
    effect_builder: EffectBuilder<REv>,
    dt_hash: DeployOrTransferHash,
    sender: I,
) -> Effects<Event<I>>
where
    REv: From<Event<I>>
        + From<BlockValidationRequest<I>>
        + From<StorageRequest>
        + From<FetcherRequest<I, Deploy>>
        + Send,
    I: Clone + Send + PartialEq + Eq + 'static,
{
    let validate_deploy = move |result: FetchResult<Deploy, I>| match result {
        FetchResult::FromStorage(deploy) | FetchResult::FromPeer(deploy, _) => {
            (deploy.deploy_or_transfer_hash() == dt_hash)
                .then(|| deploy)
                .and_then(|deploy| deploy.deploy_info().ok())
                .map_or(Event::CannotConvertDeploy(dt_hash), |deploy_info| {
                    Event::DeployFound {
                        dt_hash,
                        deploy_info: Box::new(deploy_info),
                    }
                })
        }
    };
    effect_builder
        .fetch_deploy(dt_hash.into(), sender)
        .map_or_else(validate_deploy, move || Event::DeployMissing(dt_hash))
}
fn fetch_deploy < REv , I > ( effect_builder : EffectBuilder < REv > , dt_hash : DeployOrTransferHash , sender : I , ) -> Effects < Event < I > > where REv : From < Event < I > > + From < BlockValidationRequest < I > > + From < StorageRequest > + From < FetcherRequest < I , Deploy > > + Send , I : Clone + Send + PartialEq + Eq + ' static , { let validate_deploy = move | result : FetchResult < Deploy , I > | match result { FetchResult :: FromStorage ( deploy ) | FetchResult :: FromPeer ( deploy , _ ) => { ( deploy . deploy_or_transfer_hash ( ) == dt_hash ) . then ( | | deploy ) . and_then ( | deploy | deploy . deploy_info ( ) . ok ( ) ) . map_or ( Event :: CannotConvertDeploy ( dt_hash ) , | deploy_info | { Event :: DeployFound { dt_hash , deploy_info : Box :: new ( deploy_info ) , } } ) } } ; effect_builder . fetch_deploy ( dt_hash . into ( ) , sender ) . map_or_else ( validate_deploy , move | | Event :: DeployMissing ( dt_hash ) ) }
Returns effects that fetch the deploy and validate it.
Returns effects that fetch the deploy and validate it .
effect_builder
EffectBuilder<REv>
dt_hash
DeployOrTransferHash
sender
I
effect_builder
EffectBuilder<REv>
dt_hash
DeployOrTransferHash
sender
I