mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-27 22:37:25 +00:00
Warn during long beacon state skips (#566)
* Add warn whenever trying to skip more than 3 blocks * Define block skipping threshold warning as const * Fix cargo fmt
This commit is contained in:
parent
5c97ed3562
commit
091ac07af9
@ -44,6 +44,8 @@ pub const GRAFFITI: &str = "sigp/lighthouse-0.0.0-prerelease";
|
||||
/// Only useful for testing.
|
||||
const WRITE_BLOCK_PROCESSING_SSZ: bool = cfg!(feature = "write_ssz_files");
|
||||
|
||||
const BLOCK_SKIPPING_LOGGING_THRESHOLD: u64 = 3;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum BlockProcessingOutcome {
|
||||
/// Block was valid and imported into the block graph.
|
||||
@ -374,6 +376,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
if slot == head_state.slot {
|
||||
Ok(head_state)
|
||||
} else if slot > head_state.slot {
|
||||
if slot > head_state.slot + BLOCK_SKIPPING_LOGGING_THRESHOLD {
|
||||
warn!(
|
||||
self.log,
|
||||
"Skipping more than {} blocks", BLOCK_SKIPPING_LOGGING_THRESHOLD;
|
||||
"head_slot" => head_state.slot,
|
||||
"request_slot" => slot
|
||||
)
|
||||
}
|
||||
let head_state_slot = head_state.slot;
|
||||
let mut state = head_state;
|
||||
while state.slot < slot {
|
||||
|
Loading…
Reference in New Issue
Block a user