async fn process_chunk_response(&mut self, mut response: GetChunkResponse) {
        let txn_list_with_proof = response.take_txn_list_with_proof();
        // optimistically fetch next chunk
        let chunk_size = txn_list_with_proof.get_transactions().len() as u64;
        self.request_next_chunk(chunk_size).await;

        match LedgerInfoWithSignatures::<Ed25519Signature>::from_proto(
            response.take_ledger_info_with_sigs(),
        ) {
            Ok(target) => {
                let status = self.store_transactions(target, txn_list_with_proof).await;
                counters::STATE_SYNC_TXN_REPLAYED.inc_by(chunk_size as i64);
                if status.is_ok() {
                    match self.executor_proxy.get_latest_version().await {
                        Ok(version) => {
                            self.known_version = version;
                        }
                        Err(err) => {
                            error!("[state sync] storage version read failed {:?}", err);
                        }
                    }
                }
                self.notify_subscribers(status.is_ok());
            }
            Err(err) => {
                error!("[state sync] invalid ledger info {:?}", err);
            }
        }
    }
/// processes batch of transactions downloaded from peer
/// executes transactions, updates progress state, notifies subscribers if some sync is finished
processes batch of transactions downloaded from peer
executes transactions, updates progress state, notifies subscribers if some sync is finished
processes batch of transactions downloaded from peer executes transactions updates progress state notifies subscribers if some sync is finished
async fn process_chunk_response(&mut self, mut response: GetChunkResponse) {
        let txn_list_with_proof = response.take_txn_list_with_proof();
        // optimistically fetch next chunk
        let chunk_size = txn_list_with_proof.get_transactions().len() as u64;
        self.request_next_chunk(chunk_size).await;
        match LedgerInfoWithSignatures::<Ed25519Signature>::from_proto(
            response.take_ledger_info_with_sigs(),
        ) {
            Ok(target) => {
                let status = self.store_transactions(target, txn_list_with_proof).await;
                counters::STATE_SYNC_TXN_REPLAYED.inc_by(chunk_size as i64);
                if status.is_ok() {
                    match self.executor_proxy.get_latest_version().await {
                        Ok(version) => {
                            self.known_version = version;
                        }
                        Err(err) => {
                            error!("[state sync] storage version read failed {:?}", err);
                        }
                    }
                }
                self.notify_subscribers(status.is_ok());
            }
            Err(err) => {
                error!("[state sync] invalid ledger info {:?}", err);
            }
        }
    }
async fn process_chunk_response ( & mut self , mut response : GetChunkResponse ) { let txn_list_with_proof = response . take_txn_list_with_proof ( ) ; // optimistically fetch next chunk let chunk_size = txn_list_with_proof . get_transactions ( ) . len ( ) as u64 ; self . request_next_chunk ( chunk_size ) . await ; match LedgerInfoWithSignatures :: < Ed25519Signature > :: from_proto ( response . take_ledger_info_with_sigs ( ) , ) { Ok ( target ) => { let status = self . store_transactions ( target , txn_list_with_proof ) . await ; counters :: STATE_SYNC_TXN_REPLAYED . inc_by ( chunk_size as i64 ) ; if status . is_ok ( ) { match self . executor_proxy . get_latest_version ( ) . await { Ok ( version ) => { self . known_version = version ; } Err ( err ) => { error ! ( " " err ) ; } } } self . notify_subscribers ( status . is_ok ( ) ) ; } Err ( err ) => { error ! ( " " err ) ; } } }
processes batch of transactions downloaded from peer
executes transactions, updates progress state, notifies subscribers if some sync is finished
processes batch of transactions downloaded from peer executes transactions updates progress state notifies subscribers if some sync is finished
&mut self
response
GetChunkResponse
&mut self
response
GetChunkResponse