X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-transaction-sync%2Fsrc%2Ferror.rs;h=d1f4a319e8686c86218e93ea80303dfb90c6957c;hb=cd5f09b8e34e838041a9dcdc512ddcf37a976634;hp=0a529d063ec81187336df0ba6b58055093ecca7d;hpb=41a6c674f9c06c89b0890364ac75b57b648e538e;p=rust-lightning diff --git a/lightning-transaction-sync/src/error.rs b/lightning-transaction-sync/src/error.rs index 0a529d06..d1f4a319 100644 --- a/lightning-transaction-sync/src/error.rs +++ b/lightning-transaction-sync/src/error.rs @@ -18,29 +18,32 @@ impl fmt::Display for TxSyncError { } #[derive(Debug)] -#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] pub(crate) enum InternalError { /// A transaction sync failed and needs to be retried eventually. Failed, - /// An inconsisteny was encounterd during transaction sync. + /// An inconsistency was encountered during transaction sync. Inconsistency, } -#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] impl fmt::Display for InternalError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Self::Failed => write!(f, "Failed to conduct transaction sync."), Self::Inconsistency => { - write!(f, "Encountered an inconsisteny during transaction sync.") + write!(f, "Encountered an inconsistency during transaction sync.") } } } } -#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] impl std::error::Error for InternalError {} +impl From for TxSyncError { + fn from(_e: InternalError) -> Self { + Self::Failed + } +} + #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] impl From for TxSyncError { fn from(_e: esplora_client::Error) -> Self { @@ -55,9 +58,16 @@ impl From for InternalError { } } -#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] -impl From for TxSyncError { - fn from(_e: InternalError) -> Self { +#[cfg(feature = "electrum")] +impl From for InternalError { + fn from(_e: electrum_client::Error) -> Self { + Self::Failed + } +} + +#[cfg(feature = "electrum")] +impl From for TxSyncError { + fn from(_e: electrum_client::Error) -> Self { Self::Failed } }