]> Untitled Git - bdk/commitdiff
Test refactor
authorrajarshimaitra <rajarshi149@gmail.com>
Tue, 31 Aug 2021 08:58:10 +0000 (14:28 +0530)
committerSteve Myers <steve@notmandatory.org>
Wed, 15 Sep 2021 20:44:09 +0000 (13:44 -0700)
- Fix esplora module level feature flag
- Move esplora blockchain tests to module, to cover for both variants

(cherry picked from commit 8d1d92e71e61f7c8094b3f3c8ed26b849cc8250b)

src/blockchain/esplora/mod.rs
src/blockchain/esplora/reqwest.rs

index 917aa4ad4401aff2243a41ed01cf2e588e3e941f..921a1e62c116b81e9856efb8136b580043fe5f78 100644 (file)
@@ -29,38 +29,16 @@ use bitcoin::{BlockHash, Txid};
 use crate::error::Error;
 use crate::FeeRate;
 
-#[cfg(all(
-    feature = "esplora",
-    feature = "reqwest",
-    any(feature = "async-interface", target_arch = "wasm32"),
-))]
+#[cfg(feature = "reqwest")]
 mod reqwest;
 
-#[cfg(all(
-    feature = "esplora",
-    feature = "reqwest",
-    any(feature = "async-interface", target_arch = "wasm32"),
-))]
+#[cfg(feature = "reqwest")]
 pub use self::reqwest::*;
 
-#[cfg(all(
-    feature = "esplora",
-    not(any(
-        feature = "async-interface",
-        feature = "reqwest",
-        target_arch = "wasm32"
-    )),
-))]
+#[cfg(feature = "ureq")]
 mod ureq;
 
-#[cfg(all(
-    feature = "esplora",
-    not(any(
-        feature = "async-interface",
-        feature = "reqwest",
-        target_arch = "wasm32"
-    )),
-))]
+#[cfg(feature = "ureq")]
 pub use self::ureq::*;
 
 fn into_fee_rate(target: usize, estimates: HashMap<String, f64>) -> Result<FeeRate, Error> {
@@ -141,3 +119,11 @@ impl_error!(io::Error, Io, EsploraError);
 impl_error!(std::num::ParseIntError, Parsing, EsploraError);
 impl_error!(consensus::encode::Error, BitcoinEncoding, EsploraError);
 impl_error!(bitcoin::hashes::hex::Error, Hex, EsploraError);
+
+#[cfg(test)]
+#[cfg(feature = "test-esplora")]
+crate::bdk_blockchain_tests! {
+    fn test_instance(test_client: &TestClient) -> EsploraBlockchain {
+        EsploraBlockchain::new(&format!("http://{}",test_client.electrsd.esplora_url.as_ref().unwrap()), 20)
+    }
+}
index df3132da05ffa0ec62478c6f4944ce340e222e6e..528fb7adc09b30a06bc935baec75bf8f6e4ea3ce 100644 (file)
@@ -350,11 +350,3 @@ impl ConfigurableBlockchain for EsploraBlockchain {
         Ok(blockchain)
     }
 }
-
-#[cfg(test)]
-#[cfg(feature = "test-esplora")]
-crate::bdk_blockchain_tests! {
-    fn test_instance(test_client: &TestClient) -> EsploraBlockchain {
-        EsploraBlockchain::new(&format!("http://{}",test_client.electrsd.esplora_url.as_ref().unwrap()), None, 20)
-    }
-}