mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Allow for sync state where batch is unknown (#7391)
This commit is contained in:
@@ -363,7 +363,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
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<T: BeaconChainTypes> SyncingChain<T> {
|
||||
// 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<T: BeaconChainTypes> SyncingChain<T> {
|
||||
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<T: BeaconChainTypes> SyncingChain<T> {
|
||||
}
|
||||
BatchProcessResult::NonFaultyFailure => {
|
||||
batch.processing_completed(BatchProcessingResult::NonFaultyFailure)?;
|
||||
// Simply redownload the batch.
|
||||
|
||||
// Simply re-download the batch.
|
||||
self.send_batch(network, batch_id)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user