diff --git a/Cargo.lock b/Cargo.lock index de4c36d..2a7812e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2476,7 +2476,6 @@ dependencies = [ "chacha20", "clap", "dirs", - "failure", "futures 0.3.17", "grin_api 5.2.0-alpha.1 (git+https://github.com/mimblewimble/grin)", "grin_chain 5.2.0-alpha.1 (git+https://github.com/mimblewimble/grin)", diff --git a/Cargo.toml b/Cargo.toml index 7a4e3d4..1d704e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ bytes = "0.5.6" chacha20 = "0.8.1" clap = { version = "2.33", features = ["yaml"] } dirs = "2.0" -failure = "0.1.8" futures = "0.3" hmac = { version = "0.12.0", features = ["std"]} hyper = { version = "0.14", features = ["full"] } diff --git a/src/error.rs b/src/error.rs deleted file mode 100644 index 1a4facd..0000000 --- a/src/error.rs +++ /dev/null @@ -1,45 +0,0 @@ -use failure::{self, Context, Fail}; -use std::fmt::{self, Display}; - -/// MWixnet error definition -#[derive(Debug)] -pub struct Error { - inner: Context, -} - -pub type Result = std::result::Result; - -/// MWixnet error types -#[derive(Debug, Fail)] -pub enum ErrorKind { - /// Wallet error - #[fail(display = "wallet error: {}", _0)] - WalletError(crate::wallet::WalletError), - /// Wallet error - #[fail(display = "node error: {}", _0)] - NodeError(crate::node::NodeError), -} - -impl std::error::Error for Error {} - -impl Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - Display::fmt(&self.inner, f) - } -} - -impl From for Error { - fn from(e: crate::wallet::WalletError) -> Error { - Error { - inner: Context::new(ErrorKind::WalletError(e)), - } - } -} - -impl From for Error { - fn from(e: crate::node::NodeError) -> Error { - Error { - inner: Context::new(ErrorKind::NodeError(e)), - } - } -} diff --git a/src/main.rs b/src/main.rs index f68e400..681f04d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,6 @@ use tokio::runtime::Runtime; extern crate clap; mod config; -mod error; mod node; mod onion; mod rpc; diff --git a/src/server.rs b/src/server.rs index 892bfd7..99dc49d 100644 --- a/src/server.rs +++ b/src/server.rs @@ -60,7 +60,7 @@ pub trait Server: Send + Sync { /// and assemble the coinswap transaction, posting the transaction to the configured node. /// /// Currently only a single mix node is used. Milestone 3 will include support for multiple mix nodes. - fn execute_round(&self) -> crate::error::Result<()>; + fn execute_round(&self) -> Result<(), Box>; } /// The standard MWixnet server implementation @@ -168,7 +168,7 @@ impl Server for ServerImpl { Ok(()) } - fn execute_round(&self) -> crate::error::Result<()> { + fn execute_round(&self) -> Result<(), Box> { let mut locked_state = self.submissions.lock().unwrap(); let next_block_height = self.node.get_chain_height()? + 1; @@ -258,7 +258,7 @@ pub mod mock { Ok(()) } - fn execute_round(&self) -> crate::error::Result<()> { + fn execute_round(&self) -> Result<(), Box> { Ok(()) } }