Skip to content

Commit e634904

Browse files
committed
Include required async in async-https feature
1 parent c2bd12d commit e634904

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ base64ct = "<1.6.0"
3737
default = ["blocking", "async", "async-https"]
3838
blocking = ["ureq", "ureq/socks-proxy"]
3939
async = ["reqwest", "reqwest/socks"]
40-
async-https = ["reqwest/default-tls"]
40+
async-https = ["async", "reqwest/default-tls"]

src/lib.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
//! Here is an example of how to create an asynchronous client.
2727
//!
2828
//! ```no_run
29-
//! # #[cfg(any(feature = "async", feature = "async-https"))]
29+
//! # #[cfg(feature = "async")]
3030
//! # {
3131
//! use esplora_client::Builder;
3232
//! let builder = Builder::new("https://blockstream.info/testnet/api");
@@ -60,15 +60,15 @@ use bitcoin::{BlockHash, Txid};
6060

6161
pub mod api;
6262

63-
#[cfg(any(feature = "async", feature = "async-https"))]
63+
#[cfg(feature = "async")]
6464
pub mod r#async;
6565
#[cfg(feature = "blocking")]
6666
pub mod blocking;
6767

6868
pub use api::*;
6969
#[cfg(feature = "blocking")]
7070
pub use blocking::BlockingClient;
71-
#[cfg(any(feature = "async", feature = "async-https"))]
71+
#[cfg(feature = "async")]
7272
pub use r#async::AsyncClient;
7373

7474
/// Get a fee value in sats/vbytes from the estimates
@@ -152,7 +152,7 @@ pub enum Error {
152152
#[cfg(feature = "blocking")]
153153
UreqTransport(::ureq::Transport),
154154
/// Error during reqwest HTTP request
155-
#[cfg(any(feature = "async", feature = "async-https"))]
155+
#[cfg(feature = "async")]
156156
Reqwest(::reqwest::Error),
157157
/// HTTP response error
158158
HttpResponse(u16),
@@ -197,7 +197,7 @@ macro_rules! impl_error {
197197
impl std::error::Error for Error {}
198198
#[cfg(feature = "blocking")]
199199
impl_error!(::ureq::Transport, UreqTransport, Error);
200-
#[cfg(any(feature = "async", feature = "async-https"))]
200+
#[cfg(feature = "async")]
201201
impl_error!(::reqwest::Error, Reqwest, Error);
202202
impl_error!(io::Error, Io, Error);
203203
impl_error!(std::num::ParseIntError, Parsing, Error);
@@ -211,7 +211,7 @@ mod test {
211211
use lazy_static::lazy_static;
212212
use std::env;
213213
use tokio::sync::Mutex;
214-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
214+
#[cfg(all(feature = "blocking", feature = "async"))]
215215
use {
216216
bitcoin::hashes::Hash,
217217
bitcoin::Amount,
@@ -249,10 +249,10 @@ mod test {
249249
static ref MINER: Mutex<()> = Mutex::new(());
250250
}
251251

252-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
252+
#[cfg(all(feature = "blocking", feature = "async"))]
253253
static PREMINE: OnceCell<()> = OnceCell::const_new();
254254

255-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
255+
#[cfg(all(feature = "blocking", feature = "async"))]
256256
async fn setup_clients() -> (BlockingClient, AsyncClient) {
257257
PREMINE
258258
.get_or_init(|| async {
@@ -272,14 +272,14 @@ mod test {
272272
(blocking_client, async_client)
273273
}
274274

275-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
275+
#[cfg(all(feature = "blocking", feature = "async"))]
276276
fn generate_blocks_and_wait(num: usize) {
277277
let cur_height = BITCOIND.client.get_block_count().unwrap();
278278
generate_blocks(num);
279279
wait_for_block(cur_height as usize + num);
280280
}
281281

282-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
282+
#[cfg(all(feature = "blocking", feature = "async"))]
283283
fn generate_blocks(num: usize) {
284284
let address = BITCOIND
285285
.client
@@ -291,7 +291,7 @@ mod test {
291291
.unwrap();
292292
}
293293

294-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
294+
#[cfg(all(feature = "blocking", feature = "async"))]
295295
fn wait_for_block(min_height: usize) {
296296
let mut header = ELECTRSD.client.block_headers_subscribe().unwrap();
297297
loop {
@@ -306,7 +306,7 @@ mod test {
306306
}
307307
}
308308

309-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
309+
#[cfg(all(feature = "blocking", feature = "async"))]
310310
fn exponential_backoff_poll<T, F>(mut poll: F) -> T
311311
where
312312
F: FnMut() -> Option<T>,
@@ -367,7 +367,7 @@ mod test {
367367
);
368368
}
369369

370-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
370+
#[cfg(all(feature = "blocking", feature = "async"))]
371371
#[tokio::test]
372372
async fn test_get_tx() {
373373
let (blocking_client, async_client) = setup_clients().await;
@@ -397,7 +397,7 @@ mod test {
397397
assert_eq!(tx, tx_async);
398398
}
399399

400-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
400+
#[cfg(all(feature = "blocking", feature = "async"))]
401401
#[tokio::test]
402402
async fn test_get_tx_no_opt() {
403403
let (blocking_client, async_client) = setup_clients().await;
@@ -427,7 +427,7 @@ mod test {
427427
assert_eq!(tx_no_opt, tx_no_opt_async);
428428
}
429429

430-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
430+
#[cfg(all(feature = "blocking", feature = "async"))]
431431
#[tokio::test]
432432
async fn test_get_tx_status() {
433433
let (blocking_client, async_client) = setup_clients().await;
@@ -458,7 +458,7 @@ mod test {
458458
assert!(tx_status.confirmed);
459459
}
460460

461-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
461+
#[cfg(all(feature = "blocking", feature = "async"))]
462462
#[tokio::test]
463463
async fn test_get_header_by_hash() {
464464
let (blocking_client, async_client) = setup_clients().await;
@@ -470,7 +470,7 @@ mod test {
470470
assert_eq!(block_header, block_header_async);
471471
}
472472

473-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
473+
#[cfg(all(feature = "blocking", feature = "async"))]
474474
#[tokio::test]
475475
async fn test_get_block_status() {
476476
let (blocking_client, async_client) = setup_clients().await;
@@ -490,7 +490,7 @@ mod test {
490490
assert_eq!(expected, block_status_async);
491491
}
492492

493-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
493+
#[cfg(all(feature = "blocking", feature = "async"))]
494494
#[tokio::test]
495495
async fn test_get_non_existing_block_status() {
496496
// Esplora returns the same status for orphaned blocks as for non-existing blocks:
@@ -515,7 +515,7 @@ mod test {
515515
assert_eq!(expected, block_status_async);
516516
}
517517

518-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
518+
#[cfg(all(feature = "blocking", feature = "async"))]
519519
#[tokio::test]
520520
async fn test_get_block_by_hash() {
521521
let (blocking_client, async_client) = setup_clients().await;
@@ -530,7 +530,7 @@ mod test {
530530
assert_eq!(expected, block_async);
531531
}
532532

533-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
533+
#[cfg(all(feature = "blocking", feature = "async"))]
534534
#[tokio::test]
535535
async fn test_get_block_by_hash_not_existing() {
536536
let (blocking_client, async_client) = setup_clients().await;
@@ -546,7 +546,7 @@ mod test {
546546
assert!(block_async.is_none());
547547
}
548548

549-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
549+
#[cfg(all(feature = "blocking", feature = "async"))]
550550
#[tokio::test]
551551
async fn test_get_merkle_proof() {
552552
let (blocking_client, async_client) = setup_clients().await;
@@ -577,7 +577,7 @@ mod test {
577577
assert!(merkle_proof.pos > 0);
578578
}
579579

580-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
580+
#[cfg(all(feature = "blocking", feature = "async"))]
581581
#[tokio::test]
582582
async fn test_get_merkle_block() {
583583
let (blocking_client, async_client) = setup_clients().await;
@@ -617,7 +617,7 @@ mod test {
617617
assert!(indexes[0] > 0);
618618
}
619619

620-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
620+
#[cfg(all(feature = "blocking", feature = "async"))]
621621
#[tokio::test]
622622
async fn test_get_output_status() {
623623
let (blocking_client, async_client) = setup_clients().await;
@@ -655,7 +655,7 @@ mod test {
655655
assert_eq!(output_status, output_status_async);
656656
}
657657

658-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
658+
#[cfg(all(feature = "blocking", feature = "async"))]
659659
#[tokio::test]
660660
async fn test_get_height() {
661661
let (blocking_client, async_client) = setup_clients().await;
@@ -665,7 +665,7 @@ mod test {
665665
assert_eq!(block_height, block_height_async);
666666
}
667667

668-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
668+
#[cfg(all(feature = "blocking", feature = "async"))]
669669
#[tokio::test]
670670
async fn test_get_tip_hash() {
671671
let (blocking_client, async_client) = setup_clients().await;
@@ -674,7 +674,7 @@ mod test {
674674
assert_eq!(tip_hash, tip_hash_async);
675675
}
676676

677-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
677+
#[cfg(all(feature = "blocking", feature = "async"))]
678678
#[tokio::test]
679679
async fn test_get_block_hash() {
680680
let (blocking_client, async_client) = setup_clients().await;
@@ -687,7 +687,7 @@ mod test {
687687
assert_eq!(block_hash, block_hash_async);
688688
}
689689

690-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
690+
#[cfg(all(feature = "blocking", feature = "async"))]
691691
#[tokio::test]
692692
async fn test_get_txid_at_block_index() {
693693
let (blocking_client, async_client) = setup_clients().await;
@@ -706,7 +706,7 @@ mod test {
706706
assert_eq!(txid_at_block_index, txid_at_block_index_async);
707707
}
708708

709-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
709+
#[cfg(all(feature = "blocking", feature = "async"))]
710710
#[tokio::test]
711711
async fn test_get_fee_estimates() {
712712
let (blocking_client, async_client) = setup_clients().await;
@@ -715,7 +715,7 @@ mod test {
715715
assert_eq!(fee_estimates.len(), fee_estimates_async.len());
716716
}
717717

718-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
718+
#[cfg(all(feature = "blocking", feature = "async"))]
719719
#[tokio::test]
720720
async fn test_scripthash_txs() {
721721
let (blocking_client, async_client) = setup_clients().await;
@@ -763,7 +763,7 @@ mod test {
763763
assert_eq!(scripthash_txs_txids, scripthash_txs_txids_async);
764764
}
765765

766-
#[cfg(all(feature = "blocking", any(feature = "async", feature = "async-https")))]
766+
#[cfg(all(feature = "blocking", feature = "async"))]
767767
#[tokio::test]
768768
async fn test_get_blocks() {
769769
let (blocking_client, async_client) = setup_clients().await;

0 commit comments

Comments
 (0)