Skip to content

Commit

Permalink
Sleep after temporary genesis download and verify errors
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed May 4, 2022
1 parent 5de96ca commit badb5fd
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions zebrad/src/components/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,23 @@ where
Self::handle_response(response).map_err(|e| eyre!(e))?;

let response = self.downloads.next().await.expect("downloads is nonempty");
let response = Self::handle_block_response(response);

match response {
Ok(hash) => trace!(?hash, "verified and committed block to state"),
Err(e) => {
warn!(?e, "could not download or verify genesis block, retrying");
Err(error) => {
// TODO: exit syncer on permanent service errors (NetworkError, VerifierError)
if Self::should_restart_sync(&error) {
warn!(
?error,
"could not download or verify genesis block, retrying"
);
} else {
info!(
?error,
"temporary error downloading or verifying genesis block, retrying"
);
}

tokio::time::sleep(GENESIS_TIMEOUT_RETRY).await;
}
}
Expand Down

0 comments on commit badb5fd

Please sign in to comment.