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::Poisoned => unreachable!("Poisoned batch"),
|
||||||
BatchState::Failed | BatchState::AwaitingDownload | BatchState::Processing(_) => {
|
BatchState::Failed | BatchState::AwaitingDownload | BatchState::Processing(_) => {
|
||||||
// these are all inconsistent states:
|
// 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
|
// - AwaitingDownload -> A recoverable failed batch should have been
|
||||||
// re-requested.
|
// re-requested.
|
||||||
// - Processing -> `self.current_processing_batch` is None
|
// - Processing -> `self.current_processing_batch` is None
|
||||||
@@ -395,11 +395,15 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
|||||||
// return an error.
|
// return an error.
|
||||||
return Ok(KeepChain);
|
return Ok(KeepChain);
|
||||||
} else {
|
} else {
|
||||||
return Err(RemoveChain::WrongChainState(format!(
|
// NOTE: It is possible that the batch doesn't exist for the processing id. This can happen
|
||||||
"Batch not found for current processing target {}",
|
// when we complete a batch and attempt to download a new batch but there are:
|
||||||
self.processing_target
|
// 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)
|
Ok(KeepChain)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +515,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
|||||||
imported_blocks,
|
imported_blocks,
|
||||||
penalty,
|
penalty,
|
||||||
} => {
|
} => {
|
||||||
// Penalize the peer appropiately.
|
// Penalize the peer appropriately.
|
||||||
network.report_peer(peer, *penalty, "faulty_batch");
|
network.report_peer(peer, *penalty, "faulty_batch");
|
||||||
|
|
||||||
// Check if this batch is allowed to continue
|
// Check if this batch is allowed to continue
|
||||||
@@ -553,7 +557,8 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
|||||||
}
|
}
|
||||||
BatchProcessResult::NonFaultyFailure => {
|
BatchProcessResult::NonFaultyFailure => {
|
||||||
batch.processing_completed(BatchProcessingResult::NonFaultyFailure)?;
|
batch.processing_completed(BatchProcessingResult::NonFaultyFailure)?;
|
||||||
// Simply redownload the batch.
|
|
||||||
|
// Simply re-download the batch.
|
||||||
self.send_batch(network, batch_id)
|
self.send_batch(network, batch_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user