clique: make state backfill time measurement more accurate (#10551)

This commit is contained in:
jwasinger 2019-03-30 12:28:32 -07:00 committed by Talha Cross
parent 89d627769e
commit 8840a293dd

View File

@ -280,6 +280,13 @@ impl Clique {
let last_checkpoint_number = header.number() - header.number() % self.epoch_length as u64; let last_checkpoint_number = header.number() - header.number() % self.epoch_length as u64;
debug_assert_ne!(last_checkpoint_number, header.number()); debug_assert_ne!(last_checkpoint_number, header.number());
// Catching up state, note that we don't really store block state for intermediary blocks,
// for speed.
let backfill_start = time::Instant::now();
trace!(target: "engine",
"Back-filling block state. last_checkpoint_number: {}, target: {}({}).",
last_checkpoint_number, header.number(), header.hash());
let mut chain: &mut VecDeque<Header> = &mut VecDeque::with_capacity( let mut chain: &mut VecDeque<Header> = &mut VecDeque::with_capacity(
(header.number() - last_checkpoint_number + 1) as usize); (header.number() - last_checkpoint_number + 1) as usize);
@ -306,13 +313,6 @@ impl Clique {
} }
} }
// Catching up state, note that we don't really store block state for intermediary blocks,
// for speed.
let backfill_start = time::Instant::now();
trace!(target: "engine",
"Back-filling block state. last_checkpoint_number: {}, target: {}({}).",
last_checkpoint_number, header.number(), header.hash());
// Get the state for last checkpoint. // Get the state for last checkpoint.
let last_checkpoint_hash = *chain.front() let last_checkpoint_hash = *chain.front()
.expect("chain has at least one element; qed") .expect("chain has at least one element; qed")