Refactor triedb constructors to error on invalid state root (#1230)
* add TrieError, refactor Trie DB creation * remove Result type alias due to glob import conflicts * fix fallout in state.rs * add debug, display impl for TrieError * fix fallout in account.rs * ethcore::Error::TrieError variant * fix remaining fallout in ethcore crate * added From<TrieError> impl for Error, removed map_err calls * fix test breakages * fix doc tests * update docs [ci skip]
This commit is contained in:
committed by
Gav Wood
parent
fdc22db3f4
commit
13968aaa38
@@ -224,6 +224,8 @@ pub enum Error {
|
||||
PowHashInvalid,
|
||||
/// The value of the nonce or mishash is invalid.
|
||||
PowInvalid,
|
||||
/// Error concerning TrieDBs
|
||||
TrieError(TrieError),
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
@@ -239,6 +241,7 @@ impl fmt::Display for Error {
|
||||
f.write_fmt(format_args!("Unknown engine name ({})", name)),
|
||||
Error::PowHashInvalid => f.write_str("Invalid or out of date PoW hash."),
|
||||
Error::PowInvalid => f.write_str("Invalid nonce or mishash"),
|
||||
Error::TrieError(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,6 +303,12 @@ impl From<IoError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<TrieError> for Error {
|
||||
fn from(err: TrieError) -> Error {
|
||||
Error::TrieError(err)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: uncomment below once https://github.com/rust-lang/rust/issues/27336 sorted.
|
||||
/*#![feature(concat_idents)]
|
||||
macro_rules! assimilate {
|
||||
|
||||
Reference in New Issue
Block a user