Apply error and span suggestions

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
This commit is contained in:
teor 2020-10-13 07:04:13 +10:00
parent 244066f6d9
commit d504232720
3 changed files with 5 additions and 4 deletions

View File

@ -68,11 +68,12 @@ pub struct Header {
pub solution: Solution, pub solution: Solution,
} }
/// TODO: Inline this error into zebra_consensus::error::BlockError. /// TODO: Use this error as the source for zebra_consensus::error::BlockError::Time,
/// and make `BlockError::Time` add additional context.
/// See https://github.com/ZcashFoundation/zebra/issues/1021 for more details. /// See https://github.com/ZcashFoundation/zebra/issues/1021 for more details.
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum BlockTimeError { pub enum BlockTimeError {
#[error("invalid time {0:?} in block header {1:?} {2:?}: must be less than 2 hours in the future ({3:?}). Hint: check your machine's date, time, and time zone.")] #[error("invalid time {0:?} in block header {1:?} {2:?}: block time is more than 2 hours in the future ({3:?}). Hint: check your machine's date, time, and time zone.")]
InvalidBlockTime( InvalidBlockTime(
DateTime<Utc>, DateTime<Utc>,
crate::block::Height, crate::block::Height,

View File

@ -109,7 +109,7 @@ where
let hash = block.hash(); let hash = block.hash();
// The height is already included in the ChainVerifier span // The height is already included in the ChainVerifier span
let span = tracing::debug_span!("BlockVerifier.call", ?hash); let span = tracing::debug_span!("BlockVerifier::call", ?hash);
let _entered = span.enter(); let _entered = span.enter();
// Check that this block is actually a new block. // Check that this block is actually a new block.

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!("ChainVerifier.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");