pub async fn retrieve_header(
        &mut self,
        hash: HeaderHash,
        mut options: NetworkGetOptions,
    ) -> CascadeResult<Option<SignedHeaderHashed>> {
        let result = self.find_map(|store| Ok(store.get_header(&hash)?))?;
        if result.is_some() {
            return Ok(result);
        }
        options.request_type = aingle_p2p::event::GetRequest::Pending;
        self.fetch_element(hash.clone().into(), options).await?;

        // Check if we have the data now after the network call.
        let result = self.find_map(|store| Ok(store.get_header(&hash)?))?;
        Ok(result)
    }
/// Retrieve [`SignedHeaderHashed`] from either locally or from an authority.
/// Data might not have been validated yet by the authority.
Retrieve [`SignedHeaderHashed`] from either locally or from an authority.
Data might not have been validated yet by the authority.
Retrieve [ ` SignedHeaderHashed ` ] from either locally or from an authority . Data might not have been validated yet by the authority .
pub async fn retrieve_header(
        &mut self,
        hash: HeaderHash,
        mut options: NetworkGetOptions,
    ) -> CascadeResult<Option<SignedHeaderHashed>> {
        let result = self.find_map(|store| Ok(store.get_header(&hash)?))?;
        if result.is_some() {
            return Ok(result);
        }
        options.request_type = aingle_p2p::event::GetRequest::Pending;
        self.fetch_element(hash.clone().into(), options).await?;
        // Check if we have the data now after the network call.
        let result = self.find_map(|store| Ok(store.get_header(&hash)?))?;
        Ok(result)
    }
pub async fn retrieve_header ( & mut self , hash : HeaderHash , mut options : NetworkGetOptions , ) -> CascadeResult < Option < SignedHeaderHashed > > { let result = self . find_map ( | store | Ok ( store . get_header ( & hash ) ? ) ) ? ; if result . is_some ( ) { return Ok ( result ) ; } options . request_type = aingle_p2p :: event :: GetRequest :: Pending ; self . fetch_element ( hash . clone ( ) . into ( ) , options ) . await ? ; // Check if we have the data now after the network call. let result = self . find_map ( | store | Ok ( store . get_header ( & hash ) ? ) ) ? ; Ok ( result ) }
Retrieve [`SignedHeaderHashed`] from either locally or from an authority.
Retrieve [ ` SignedHeaderHashed ` ] from either locally or from an authority .
&mut self
hash
HeaderHash
options
NetworkGetOptions
&mut self
hash
HeaderHash
options
NetworkGetOptions