pub(crate) async fn download_zero_state(engine: &dyn EngineOperations, handle: &BlockHandle) -> Result<ShardStateStuff> {
    if handle.state_inited() {
        return engine.load_state(handle.id()).await
    }
    loop {
        match engine.download_zerostate(handle.id()).await {
            Ok((state, state_bytes)) => {
                engine.store_zerostate(&handle, &state, &state_bytes).await?;
                engine.set_applied(handle, 0).await?;
                engine.process_full_state_in_ext_db(&state).await?;
                return Ok(state)
            }
            Err(err) => log::warn!(target: "boot", "download_zero_state error: {}", err)
        }
        futures_timer::Delay::new(Duration::from_secs(1)).await;
    }
}
/// download zero state and store it
download zero state and store it
download zero state and store it
pub(crate) async fn download_zero_state(engine: &dyn EngineOperations, handle: &BlockHandle) -> Result<ShardStateStuff> {
    if handle.state_inited() {
        return engine.load_state(handle.id()).await
    }
    loop {
        match engine.download_zerostate(handle.id()).await {
            Ok((state, state_bytes)) => {
                engine.store_zerostate(&handle, &state, &state_bytes).await?;
                engine.set_applied(handle, 0).await?;
                engine.process_full_state_in_ext_db(&state).await?;
                return Ok(state)
            }
            Err(err) => log::warn!(target: "boot", "download_zero_state error: {}", err)
        }
        futures_timer::Delay::new(Duration::from_secs(1)).await;
    }
}
pub ( crate ) async fn download_zero_state ( engine : & dyn EngineOperations , handle : & BlockHandle ) -> Result < ShardStateStuff > { if handle . state_inited ( ) { return engine . load_state ( handle . id ( ) ) . await } loop { match engine . download_zerostate ( handle . id ( ) ) . await { Ok ( ( state , state_bytes ) ) => { engine . store_zerostate ( & handle , & state , & state_bytes ) . await ? ; engine . set_applied ( handle , 0 ) . await ? ; engine . process_full_state_in_ext_db ( & state ) . await ? ; return Ok ( state ) } Err ( err ) => log :: warn ! ( target " " " " err ) } futures_timer :: Delay :: new ( Duration :: from_secs ( 1 ) ) . await ; } }
download zero state and store it
download zero state and store it
engine
&dyn EngineOperations
handle
&BlockHandle
engine
&dyn EngineOperations
handle
&BlockHandle