Implement `ElectrumSyncClient`
[rust-lightning] / lightning-transaction-sync / src / error.rs
index 73d9de70169d6ea559121c2aaf9fc5656b7d1f5c..d1f4a319e8686c86218e93ea80303dfb90c6957c 100644 (file)
@@ -18,7 +18,6 @@ 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,
@@ -26,7 +25,6 @@ pub(crate) enum InternalError {
        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 {
@@ -38,9 +36,14 @@ impl fmt::Display for InternalError {
        }
 }
 
-#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
 impl std::error::Error for InternalError {}
 
+impl From<InternalError> for TxSyncError {
+       fn from(_e: InternalError) -> Self {
+               Self::Failed
+       }
+}
+
 #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
 impl From<esplora_client::Error> for TxSyncError {
        fn from(_e: esplora_client::Error) -> Self {
@@ -55,9 +58,16 @@ impl From<esplora_client::Error> for InternalError {
        }
 }
 
-#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
-impl From<InternalError> for TxSyncError {
-       fn from(_e: InternalError) -> Self {
+#[cfg(feature = "electrum")]
+impl From<electrum_client::Error> for InternalError {
+       fn from(_e: electrum_client::Error) -> Self {
+               Self::Failed
+       }
+}
+
+#[cfg(feature = "electrum")]
+impl From<electrum_client::Error> for TxSyncError {
+       fn from(_e: electrum_client::Error) -> Self {
                Self::Failed
        }
 }