async fn download_key_block_proof(
    engine: &dyn EngineOperations,
    handle: &BlockHandle,
    zero_state: Option<&ShardStateStuff>,
    prev_block_proof: Option<&BlockProofStuff>,
) -> Result<BlockProofStuff> {
    if let Ok(proof) = engine.load_block_proof(handle, false).await {
        return Ok(proof)
    }
    loop {
        let proof = engine.download_block_proof(handle.id(), false, true).await?;
        let result = if let Some(prev_block_proof) = prev_block_proof {
            proof.check_with_prev_key_block_proof(prev_block_proof)
        } else if let Some(zero_state) = zero_state {
            proof.check_with_master_state(zero_state)
        } else {
            unreachable!("Impossible variant")
        };
        match result {
            Ok(_) => {
                engine.store_block_proof(&handle, &proof).await?;
                return Ok(proof)
            }
            Err(err) => {
                log::warn!(target: "boot", "check_proof error: {}", err);
                futures_timer::Delay::new(Duration::from_secs(1)).await;
            }
        }
    }
}
/// download key block proof, check it and store
download key block proof, check it and store
download key block proof check it and store
async fn download_key_block_proof(
    engine: &dyn EngineOperations,
    handle: &BlockHandle,
    zero_state: Option<&ShardStateStuff>,
    prev_block_proof: Option<&BlockProofStuff>,
) -> Result<BlockProofStuff> {
    if let Ok(proof) = engine.load_block_proof(handle, false).await {
        return Ok(proof)
    }
    loop {
        let proof = engine.download_block_proof(handle.id(), false, true).await?;
        let result = if let Some(prev_block_proof) = prev_block_proof {
            proof.check_with_prev_key_block_proof(prev_block_proof)
        } else if let Some(zero_state) = zero_state {
            proof.check_with_master_state(zero_state)
        } else {
            unreachable!("Impossible variant")
        };
        match result {
            Ok(_) => {
                engine.store_block_proof(&handle, &proof).await?;
                return Ok(proof)
            }
            Err(err) => {
                log::warn!(target: "boot", "check_proof error: {}", err);
                futures_timer::Delay::new(Duration::from_secs(1)).await;
            }
        }
    }
}
async fn download_key_block_proof ( engine : & dyn EngineOperations , handle : & BlockHandle , zero_state : Option < & ShardStateStuff > , prev_block_proof : Option < & BlockProofStuff > , ) -> Result < BlockProofStuff > { if let Ok ( proof ) = engine . load_block_proof ( handle , false ) . await { return Ok ( proof ) } loop { let proof = engine . download_block_proof ( handle . id ( ) , false , true ) . await ? ; let result = if let Some ( prev_block_proof ) = prev_block_proof { proof . check_with_prev_key_block_proof ( prev_block_proof ) } else if let Some ( zero_state ) = zero_state { proof . check_with_master_state ( zero_state ) } else { unreachable ! ( " " ) } ; match result { Ok ( _ ) => { engine . store_block_proof ( & handle , & proof ) . await ? ; return Ok ( proof ) } Err ( err ) => { log :: warn ! ( target " " " " err ) ; futures_timer :: Delay :: new ( Duration :: from_secs ( 1 ) ) . await ; } } } }
download key block proof, check it and store
download key block proof check it and store
engine
&dyn EngineOperations
handle
&BlockHandle
zero_state
Option<&ShardStateStuff>
prev_block_proof
Option<&BlockProofStuff>
engine
&dyn EngineOperations
handle
&BlockHandle
zero_state
Option<&ShardStateStuff>
prev_block_proof
Option<&BlockProofStuff>