fix: Improve checkpoint diagnostics

Improve metrics and logging when the checkpoint verifier is waiting for
more blocks.
This commit is contained in:
teor 2020-08-27 19:16:56 +10:00 committed by Deirdre Connolly
parent 3ed967bcf8
commit 7931766c84
1 changed files with 11 additions and 1 deletions

View File

@ -267,6 +267,13 @@ impl CheckpointVerifier {
if height == block::Height(pending_height.0 + 1) {
pending_height = height;
} else {
let gap = height.0 - pending_height.0;
// Try to log a useful message when checkpointing has issues
tracing::trace!(contiguous_height = ?pending_height,
next_height = ?height,
?gap,
"Waiting for more checkpoint blocks");
metrics::gauge!("checkpoint.contiguous.height", pending_height.0 as i64);
break;
}
}
@ -331,7 +338,10 @@ impl CheckpointVerifier {
InitialTip(previous_height) | PreviousCheckpoint(previous_height)
if (height <= previous_height) =>
{
Err(format!("Block has already been verified. {:?}", height))?
Err(format!(
"Block height has already been verified. {:?}",
height
))?
}
InitialTip(_) | PreviousCheckpoint(_) => {}
// We're finished, so no checkpoint height is valid