Add a hash debug-level span for block verification

This commit is contained in:
teor 2020-10-12 17:05:55 +10:00
parent c4630cd1f5
commit 244066f6d9
2 changed files with 8 additions and 3 deletions

View File

@ -108,6 +108,10 @@ where
async move { async move {
let hash = block.hash(); let hash = block.hash();
// The height is already included in the ChainVerifier span
let span = tracing::debug_span!("BlockVerifier.call", ?hash);
let _entered = span.enter();
// Check that this block is actually a new block. // Check that this block is actually a new block.
match state_service match state_service
.ready_and() .ready_and()
@ -124,8 +128,9 @@ where
_ => unreachable!("wrong response to Request::Depth"), _ => unreachable!("wrong response to Request::Depth"),
} }
// These checks only apply to generated blocks. We check the block // We repeat the height checks here, to ensure that generated blocks
// height for parsed blocks when we deserialize them. // are valid. (We check the block heights for parsed blocks when we
// deserialize them.)
let height = block let height = block
.coinbase_height() .coinbase_height()
.ok_or(BlockError::MissingHeight(hash))?; .ok_or(BlockError::MissingHeight(hash))?;

View File

@ -77,7 +77,7 @@ where
fn call(&mut self, block: Arc<Block>) -> Self::Future { fn call(&mut self, block: Arc<Block>) -> Self::Future {
let height = block.coinbase_height(); let height = block.coinbase_height();
let span = tracing::info_span!("chain_call", ?height); let span = tracing::info_span!("ChainVerifier.call", ?height);
let _entered = span.enter(); let _entered = span.enter();
tracing::debug!("verifying new block"); tracing::debug!("verifying new block");