}
#[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<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 {
}
}
-#[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
}
}