new error type

This commit is contained in:
keorn 2016-12-02 13:32:00 +00:00
parent 0eb55cbd4d
commit e0f2fac441
2 changed files with 3 additions and 1 deletions

View File

@ -275,7 +275,6 @@ impl Engine for AuthorityRound {
} }
fn verify_block_family(&self, header: &Header, parent: &Header, _block: Option<&[u8]>) -> Result<(), Error> { fn verify_block_family(&self, header: &Header, parent: &Header, _block: Option<&[u8]>) -> Result<(), Error> {
// Don't calculate difficulty for genesis blocks.
if header.number() == 0 { if header.number() == 0 {
return Err(From::from(BlockError::RidiculousNumber(OutOfBounds { min: Some(1), max: None, found: header.number() }))); return Err(From::from(BlockError::RidiculousNumber(OutOfBounds { min: Some(1), max: None, found: header.number() })));
} }

View File

@ -56,6 +56,8 @@ pub enum EngineError {
NotProposer(Mismatch<H160>), NotProposer(Mismatch<H160>),
/// Message was not expected. /// Message was not expected.
UnexpectedMessage, UnexpectedMessage,
/// Seal field has an unexpected size.
BadSealFieldSize(OutOfBounds<usize>),
} }
impl fmt::Display for EngineError { impl fmt::Display for EngineError {
@ -66,6 +68,7 @@ impl fmt::Display for EngineError {
NotProposer(ref mis) => format!("Author is not a current proposer: {}", mis), NotProposer(ref mis) => format!("Author is not a current proposer: {}", mis),
NotAuthorized(ref address) => format!("Signer {} is not authorized.", address), NotAuthorized(ref address) => format!("Signer {} is not authorized.", address),
UnexpectedMessage => "This Engine should not be fed messages.".into(), UnexpectedMessage => "This Engine should not be fed messages.".into(),
BadSealFieldSize(ref oob) => format!("Seal field has an unexpected length: {}", oob),
}; };
f.write_fmt(format_args!("Engine error ({})", msg)) f.write_fmt(format_args!("Engine error ({})", msg))