diff --git a/payjoin/src/send/multiparty/error.rs b/payjoin/src/send/multiparty/error.rs index af68457f8..3d72c7728 100644 --- a/payjoin/src/send/multiparty/error.rs +++ b/payjoin/src/send/multiparty/error.rs @@ -79,33 +79,3 @@ impl std::error::Error for FinalizedError { } } } - -#[derive(Debug)] -pub struct FinalizeResponseError(InternalFinalizeResponseError); - -#[derive(Debug)] -pub(crate) enum InternalFinalizeResponseError { - DirectoryResponse(DirectoryResponseError), -} - -impl From for FinalizeResponseError { - fn from(value: InternalFinalizeResponseError) -> Self { FinalizeResponseError(value) } -} - -impl From for FinalizeResponseError { - fn from(err: DirectoryResponseError) -> Self { - FinalizeResponseError(InternalFinalizeResponseError::DirectoryResponse(err)) - } -} - -impl Display for FinalizeResponseError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) } -} - -impl std::error::Error for FinalizeResponseError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match &self.0 { - InternalFinalizeResponseError::DirectoryResponse(e) => Some(e), - } - } -} diff --git a/payjoin/src/send/multiparty/mod.rs b/payjoin/src/send/multiparty/mod.rs index 2185ffaed..9781bca1b 100644 --- a/payjoin/src/send/multiparty/mod.rs +++ b/payjoin/src/send/multiparty/mod.rs @@ -1,7 +1,6 @@ use bitcoin::{FeeRate, Psbt}; use error::{ - CreateRequestError, FinalizeResponseError, FinalizedError, InternalCreateRequestError, - InternalFinalizedError, + CreateRequestError, FinalizedError, InternalCreateRequestError, InternalFinalizedError, }; use serde::{Deserialize, Serialize}; use url::Url; @@ -192,7 +191,7 @@ impl FinalizeContext { self, response: &[u8], ohttp_ctx: ohttp::ClientResponse, - ) -> Result<(), FinalizeResponseError> { + ) -> Result<(), FinalizedError> { match process_post_res(response, ohttp_ctx) { Ok(()) => Ok(()), Err(e) => Err(e.into()),