Thiserror changeover (#3728)
* WIP remove failure from all `Cargo.toml` * WIP remove `extern crate failure_derive` * Use `thiserror` to fix all errors * StoreErr is still a tuple * Remove another set of unnecessary `.into()`s * update fuzz tests * update pool/fuzz dependencies in cargo.lock * small changes based on feedback Co-authored-by: trevyn <trevyn-git@protonmail.com>
This commit is contained in:
@@ -79,8 +79,8 @@ pub fn get_block(
|
||||
while let Err(e) = result {
|
||||
let mut new_key_id = key_id.to_owned();
|
||||
match e {
|
||||
self::Error::Chain(c) => match c.kind() {
|
||||
chain::ErrorKind::DuplicateCommitment(_) => {
|
||||
self::Error::Chain(c) => match c {
|
||||
chain::Error::DuplicateCommitment(_) => {
|
||||
debug!(
|
||||
"Duplicate commit for potential coinbase detected. Trying next derivation."
|
||||
);
|
||||
@@ -182,20 +182,18 @@ fn build_block(
|
||||
match chain.set_txhashset_roots(&mut b) {
|
||||
Ok(_) => Ok((b, block_fees)),
|
||||
Err(e) => {
|
||||
match e.kind() {
|
||||
match e {
|
||||
// If this is a duplicate commitment then likely trying to use
|
||||
// a key that hass already been derived but not in the wallet
|
||||
// for some reason, allow caller to retry.
|
||||
chain::ErrorKind::DuplicateCommitment(e) => Err(Error::Chain(
|
||||
chain::ErrorKind::DuplicateCommitment(e).into(),
|
||||
)),
|
||||
chain::Error::DuplicateCommitment(e) => {
|
||||
Err(Error::Chain(chain::Error::DuplicateCommitment(e)))
|
||||
}
|
||||
|
||||
// Some other issue, possibly duplicate kernel
|
||||
_ => {
|
||||
error!("Error setting txhashset root to build a block: {:?}", e);
|
||||
Err(Error::Chain(
|
||||
chain::ErrorKind::Other(format!("{:?}", e)).into(),
|
||||
))
|
||||
Err(Error::Chain(chain::Error::Other(format!("{:?}", e))))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ impl Handler {
|
||||
if let Err(e) = res {
|
||||
// Return error status
|
||||
error!(
|
||||
"(Server ID: {}) Failed to validate solution at height {}, hash {}, edge_bits {}, nonce {}, job_id {}, {}: {}",
|
||||
"(Server ID: {}) Failed to validate solution at height {}, hash {}, edge_bits {}, nonce {}, job_id {}, {}",
|
||||
self.id,
|
||||
params.height,
|
||||
b.hash(),
|
||||
@@ -432,7 +432,6 @@ impl Handler {
|
||||
params.nonce,
|
||||
params.job_id,
|
||||
e,
|
||||
e.backtrace().unwrap(),
|
||||
);
|
||||
self.workers
|
||||
.update_stats(worker_id, |worker_stats| worker_stats.num_rejected += 1);
|
||||
|
||||
Reference in New Issue
Block a user