Merge pull request #332 from ethcore/verbose-difficulty

Make difficulty error less cryptic
This commit is contained in:
Svyatoslav Nikolsky 2016-12-14 18:00:41 +03:00 committed by GitHub
commit af23fefa17
2 changed files with 3 additions and 3 deletions

View File

@ -84,7 +84,7 @@ impl<'a> HeaderRule for HeaderWork<'a> {
if work == self.header.raw.bits { if work == self.header.raw.bits {
Ok(()) Ok(())
} else { } else {
Err(Error::Difficulty) Err(Error::Difficulty { expected: work, actual: self.header.raw.bits })
} }
} }
} }

View File

@ -1,4 +1,4 @@
use primitives::hash::H256; use primitives::{H256, Compact};
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
/// All possible verification errors /// All possible verification errors
@ -20,7 +20,7 @@ pub enum Error {
/// One of the transactions is invalid (corresponding index and specific transaction error) /// One of the transactions is invalid (corresponding index and specific transaction error)
Transaction(usize, TransactionError), Transaction(usize, TransactionError),
/// nBits do not match difficulty rules /// nBits do not match difficulty rules
Difficulty, Difficulty { expected: Compact, actual: Compact },
/// Invalid merkle root /// Invalid merkle root
MerkleRoot, MerkleRoot,
/// Coinbase spends too much /// Coinbase spends too much