Update some contextual validation comments and error messages

This commit is contained in:
teor 2020-11-18 15:23:18 +10:00
parent 1bf5ff07fb
commit fa03b83351
1 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,8 @@ use super::check;
/// ///
/// The relevant chain is an iterator over the ancestors of `block`, starting /// The relevant chain is an iterator over the ancestors of `block`, starting
/// with its parent block. /// with its parent block.
///
/// Panics if the finalized state is empty.
#[tracing::instrument( #[tracing::instrument(
name = "contextual_validation", name = "contextual_validation",
fields(?network), fields(?network),
@ -30,7 +32,7 @@ where
C::Item: AsRef<Block>, C::Item: AsRef<Block>,
{ {
let finalized_tip_height = finalized_tip_height let finalized_tip_height = finalized_tip_height
.expect("finalized state must contain at least one block to use the non-finalized state"); .expect("finalized state must contain at least one block to do contextual validation");
check::block_is_not_orphaned(finalized_tip_height, prepared.height)?; check::block_is_not_orphaned(finalized_tip_height, prepared.height)?;
let mut relevant_chain = relevant_chain.into_iter(); let mut relevant_chain = relevant_chain.into_iter();