diff --git a/beacon_node/network/src/sync/range_sync/chain.rs b/beacon_node/network/src/sync/range_sync/chain.rs index 27f071f081..cdbb9f2588 100644 --- a/beacon_node/network/src/sync/range_sync/chain.rs +++ b/beacon_node/network/src/sync/range_sync/chain.rs @@ -363,7 +363,7 @@ impl SyncingChain { BatchState::Poisoned => unreachable!("Poisoned batch"), BatchState::Failed | BatchState::AwaitingDownload | BatchState::Processing(_) => { // these are all inconsistent states: - // - Failed -> non recoverable batch. Chain should have beee removed + // - Failed -> non recoverable batch. Chain should have been removed // - AwaitingDownload -> A recoverable failed batch should have been // re-requested. // - Processing -> `self.current_processing_batch` is None @@ -395,11 +395,15 @@ impl SyncingChain { // return an error. return Ok(KeepChain); } else { - return Err(RemoveChain::WrongChainState(format!( - "Batch not found for current processing target {}", - self.processing_target - ))); + // NOTE: It is possible that the batch doesn't exist for the processing id. This can happen + // when we complete a batch and attempt to download a new batch but there are: + // 1. No idle peers to download from + // 2. No good peers on sampling subnets + // + // In these cases, a batch will not yet exist. + debug!(batch = %self.processing_target, "The processing batch has not been scheduled for download yet. Awaiting progress"); } + Ok(KeepChain) } @@ -511,7 +515,7 @@ impl SyncingChain { imported_blocks, penalty, } => { - // Penalize the peer appropiately. + // Penalize the peer appropriately. network.report_peer(peer, *penalty, "faulty_batch"); // Check if this batch is allowed to continue @@ -553,7 +557,8 @@ impl SyncingChain { } BatchProcessResult::NonFaultyFailure => { batch.processing_completed(BatchProcessingResult::NonFaultyFailure)?; - // Simply redownload the batch. + + // Simply re-download the batch. self.send_batch(network, batch_id) } }