type Hash = String;
error_chain! {
errors {
AlreadyImported(hash: Hash) {
description("transaction is already in the pool"),
display("[{}] already imported", hash)
}
TooCheapToEnter(hash: Hash, min_score: String) {
description("the pool is full and transaction is too cheap to replace any transaction"),
display("[{}] too cheap to enter the pool. Min score: {}", hash, min_score)
}
TooCheapToReplace(old_hash: Hash, hash: Hash) {
description("transaction is too cheap to replace existing transaction in the pool"),
display("[{}] too cheap to replace: {}", hash, old_hash)
}
}
}
#[cfg(test)]
impl PartialEq for ErrorKind {
fn eq(&self, other: &Self) -> bool {
use self::ErrorKind::*;
match (self, other) {
(&AlreadyImported(ref h1), &AlreadyImported(ref h2)) => h1 == h2,
(&TooCheapToEnter(ref h1, ref s1), &TooCheapToEnter(ref h2, ref s2)) => h1 == h2 && s1 == s2,
(&TooCheapToReplace(ref old1, ref new1), &TooCheapToReplace(ref old2, ref new2)) => old1 == old2 && new1 == new2,
_ => false,
}
}
}