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.
|
/// Only useful for testing.
|
||||||
const WRITE_BLOCK_PROCESSING_SSZ: bool = cfg!(feature = "write_ssz_files");
|
const WRITE_BLOCK_PROCESSING_SSZ: bool = cfg!(feature = "write_ssz_files");
|
||||||
|
|
||||||
|
const BLOCK_SKIPPING_LOGGING_THRESHOLD: u64 = 3;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum BlockProcessingOutcome {
|
pub enum BlockProcessingOutcome {
|
||||||
/// Block was valid and imported into the block graph.
|
/// Block was valid and imported into the block graph.
|
||||||
@ -374,6 +376,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
if slot == head_state.slot {
|
if slot == head_state.slot {
|
||||||
Ok(head_state)
|
Ok(head_state)
|
||||||
} else if slot > head_state.slot {
|
} 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 head_state_slot = head_state.slot;
|
||||||
let mut state = head_state;
|
let mut state = head_state;
|
||||||
while state.slot < slot {
|
while state.slot < slot {
|
||||||
|
Loading…
Reference in New Issue
Block a user