mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-01 03:33:47 +00:00
Drop skip too large condition for liveness safety (#6014)
* Drop skip too large condition for liveness safety
This commit is contained in:
@@ -114,7 +114,7 @@ use std::collections::HashSet;
|
||||
use std::io::prelude::*;
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::time::Duration;
|
||||
use store::iter::{BlockRootsIterator, ParentRootBlockIterator, StateRootsIterator};
|
||||
use store::{
|
||||
DatabaseBlock, Error as DBError, HotColdDB, KeyValueStore, KeyValueStoreOp, StoreItem, StoreOp,
|
||||
@@ -1410,10 +1410,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
)
|
||||
}
|
||||
|
||||
let start_slot = head_state.slot();
|
||||
let task_start = Instant::now();
|
||||
let max_task_runtime = Duration::from_secs(self.spec.seconds_per_slot);
|
||||
|
||||
let head_state_slot = head_state.slot();
|
||||
let mut state = head_state;
|
||||
|
||||
@@ -1423,18 +1419,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
};
|
||||
|
||||
while state.slot() < slot {
|
||||
// Do not allow and forward state skip that takes longer than the maximum task duration.
|
||||
//
|
||||
// This is a protection against nodes doing too much work when they're not synced
|
||||
// to a chain.
|
||||
if task_start + max_task_runtime < Instant::now() {
|
||||
return Err(Error::StateSkipTooLarge {
|
||||
start_slot,
|
||||
requested_slot: slot,
|
||||
max_task_runtime,
|
||||
});
|
||||
}
|
||||
|
||||
// Note: supplying some `state_root` when it is known would be a cheap and easy
|
||||
// optimization.
|
||||
match per_slot_processing(&mut state, skip_state_root, &self.spec) {
|
||||
|
||||
Reference in New Issue
Block a user