new error type
This commit is contained in:
parent
0eb55cbd4d
commit
e0f2fac441
@ -275,7 +275,6 @@ impl Engine for AuthorityRound {
|
||||
}
|
||||
|
||||
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 {
|
||||
return Err(From::from(BlockError::RidiculousNumber(OutOfBounds { min: Some(1), max: None, found: header.number() })));
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ pub enum EngineError {
|
||||
NotProposer(Mismatch<H160>),
|
||||
/// Message was not expected.
|
||||
UnexpectedMessage,
|
||||
/// Seal field has an unexpected size.
|
||||
BadSealFieldSize(OutOfBounds<usize>),
|
||||
}
|
||||
|
||||
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),
|
||||
NotAuthorized(ref address) => format!("Signer {} is not authorized.", address),
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user