pub fn new<T: SlotClock + 'static, E: EthSpec>(
        duty: AttesterData,
        validator_store: &ValidatorStore<T, E>,
        spec: &ChainSpec,
    ) -> Result<Self, Error> {
        let selection_proof = validator_store
            .produce_selection_proof(&duty.pubkey, duty.slot)
            .ok_or(Error::FailedToProduceSelectionProof)?;

        let selection_proof = selection_proof
            .is_aggregator(duty.committee_length as usize, spec)
            .map_err(Error::InvalidModulo)
            .map(|is_aggregator| {
                if is_aggregator {
                    Some(selection_proof)
                } else {
                    // Don't bother storing the selection proof if the validator isn't an
                    // aggregator, we won't need it.
                    None
                }
            })?;

        Ok(Self {
            duty,
            selection_proof,
        })
    }
/// Instantiate `Self`, computing the selection proof as well.
Instantiate `Self`, computing the selection proof as well.
Instantiate ` Self ` computing the selection proof as well .
pub fn new<T: SlotClock + 'static, E: EthSpec>(
        duty: AttesterData,
        validator_store: &ValidatorStore<T, E>,
        spec: &ChainSpec,
    ) -> Result<Self, Error> {
        let selection_proof = validator_store
            .produce_selection_proof(&duty.pubkey, duty.slot)
            .ok_or(Error::FailedToProduceSelectionProof)?;
        let selection_proof = selection_proof
            .is_aggregator(duty.committee_length as usize, spec)
            .map_err(Error::InvalidModulo)
            .map(|is_aggregator| {
                if is_aggregator {
                    Some(selection_proof)
                } else {
                    // Don't bother storing the selection proof if the validator isn't an
                    // aggregator, we won't need it.
                    None
                }
            })?;
        Ok(Self {
            duty,
            selection_proof,
        })
    }
pub fn new < T : SlotClock + ' static , E : EthSpec > ( duty : AttesterData , validator_store : & ValidatorStore < T , E > , spec : & ChainSpec , ) -> Result < Self , Error > { let selection_proof = validator_store . produce_selection_proof ( & duty . pubkey , duty . slot ) . ok_or ( Error :: FailedToProduceSelectionProof ) ? ; let selection_proof = selection_proof . is_aggregator ( duty . committee_length as usize , spec ) . map_err ( Error :: InvalidModulo ) . map ( | is_aggregator | { if is_aggregator { Some ( selection_proof ) } else { // Don't bother storing the selection proof if the validator isn't an // aggregator, we won't need it. None } } ) ? ; Ok ( Self { duty , selection_proof , } ) }
Instantiate `Self`, computing the selection proof as well.
Instantiate ` Self ` computing the selection proof as well .
duty
AttesterData
validator_store
&ValidatorStore<T, E>
spec
&ChainSpec