pub fn attester_duties<T: BeaconChainTypes>(
    request_epoch: Epoch,
    request_indices: &[u64],
    chain: &BeaconChain<T>,
) -> Result<ApiDuties, warp::reject::Rejection> {
    let current_epoch = chain
        .epoch()
        .map_err(warp_utils::reject::beacon_chain_error)?;
    let next_epoch = current_epoch + 1;

    if request_epoch > next_epoch {
        Err(warp_utils::reject::custom_bad_request(format!(
            "request epoch {} is more than one epoch past the current epoch {}",
            request_epoch, current_epoch
        )))
    } else if request_epoch == current_epoch || request_epoch == next_epoch {
        cached_attestation_duties(request_epoch, request_indices, chain)
    } else {
        compute_historic_attester_duties(request_epoch, request_indices, chain)
    }
}
/// Handles a request from the HTTP API for attester duties.
Handles a request from the HTTP API for attester duties.
Handles a request from the HTTP API for attester duties .
pub fn attester_duties<T: BeaconChainTypes>(
    request_epoch: Epoch,
    request_indices: &[u64],
    chain: &BeaconChain<T>,
) -> Result<ApiDuties, warp::reject::Rejection> {
    let current_epoch = chain
        .epoch()
        .map_err(warp_utils::reject::beacon_chain_error)?;
    let next_epoch = current_epoch + 1;
    if request_epoch > next_epoch {
        Err(warp_utils::reject::custom_bad_request(format!(
            "request epoch {} is more than one epoch past the current epoch {}",
            request_epoch, current_epoch
        )))
    } else if request_epoch == current_epoch || request_epoch == next_epoch {
        cached_attestation_duties(request_epoch, request_indices, chain)
    } else {
        compute_historic_attester_duties(request_epoch, request_indices, chain)
    }
}
pub fn attester_duties < T : BeaconChainTypes > ( request_epoch : Epoch , request_indices : & [ u64 ] , chain : & BeaconChain < T > , ) -> Result < ApiDuties , warp :: reject :: Rejection > { let current_epoch = chain . epoch ( ) . map_err ( warp_utils :: reject :: beacon_chain_error ) ? ; let next_epoch = current_epoch + 1 ; if request_epoch > next_epoch { Err ( warp_utils :: reject :: custom_bad_request ( format ! ( " " request_epoch current_epoch ) ) ) } else if request_epoch == current_epoch || request_epoch == next_epoch { cached_attestation_duties ( request_epoch , request_indices , chain ) } else { compute_historic_attester_duties ( request_epoch , request_indices , chain ) } }
Handles a request from the HTTP API for attester duties.
Handles a request from the HTTP API for attester duties .
request_epoch
Epoch
request_indices
&[u64]
chain
&BeaconChain<T>