26
26
//! Here is an example of how to create an asynchronous client.
27
27
//!
28
28
//! ```no_run
29
- //! # #[cfg(any( feature = "async", feature = "async-https") )]
29
+ //! # #[cfg(feature = "async")]
30
30
//! # {
31
31
//! use esplora_client::Builder;
32
32
//! let builder = Builder::new("https://blockstream.info/testnet/api");
@@ -60,15 +60,15 @@ use bitcoin::{BlockHash, Txid};
60
60
61
61
pub mod api;
62
62
63
- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
63
+ #[ cfg( feature = "async" ) ]
64
64
pub mod r#async;
65
65
#[ cfg( feature = "blocking" ) ]
66
66
pub mod blocking;
67
67
68
68
pub use api:: * ;
69
69
#[ cfg( feature = "blocking" ) ]
70
70
pub use blocking:: BlockingClient ;
71
- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
71
+ #[ cfg( feature = "async" ) ]
72
72
pub use r#async:: AsyncClient ;
73
73
74
74
/// Get a fee value in sats/vbytes from the estimates
@@ -152,7 +152,7 @@ pub enum Error {
152
152
#[ cfg( feature = "blocking" ) ]
153
153
UreqTransport ( :: ureq:: Transport ) ,
154
154
/// Error during reqwest HTTP request
155
- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
155
+ #[ cfg( feature = "async" ) ]
156
156
Reqwest ( :: reqwest:: Error ) ,
157
157
/// HTTP response error
158
158
HttpResponse ( u16 ) ,
@@ -197,7 +197,7 @@ macro_rules! impl_error {
197
197
impl std:: error:: Error for Error { }
198
198
#[ cfg( feature = "blocking" ) ]
199
199
impl_error ! ( :: ureq:: Transport , UreqTransport , Error ) ;
200
- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
200
+ #[ cfg( feature = "async" ) ]
201
201
impl_error ! ( :: reqwest:: Error , Reqwest , Error ) ;
202
202
impl_error ! ( io:: Error , Io , Error ) ;
203
203
impl_error ! ( std:: num:: ParseIntError , Parsing , Error ) ;
@@ -211,7 +211,7 @@ mod test {
211
211
use lazy_static:: lazy_static;
212
212
use std:: env;
213
213
use tokio:: sync:: Mutex ;
214
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
214
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
215
215
use {
216
216
bitcoin:: hashes:: Hash ,
217
217
bitcoin:: Amount ,
@@ -249,10 +249,10 @@ mod test {
249
249
static ref MINER : Mutex <( ) > = Mutex :: new( ( ) ) ;
250
250
}
251
251
252
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
252
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
253
253
static PREMINE : OnceCell < ( ) > = OnceCell :: const_new ( ) ;
254
254
255
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
255
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
256
256
async fn setup_clients ( ) -> ( BlockingClient , AsyncClient ) {
257
257
PREMINE
258
258
. get_or_init ( || async {
@@ -272,14 +272,14 @@ mod test {
272
272
( blocking_client, async_client)
273
273
}
274
274
275
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
275
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
276
276
fn generate_blocks_and_wait ( num : usize ) {
277
277
let cur_height = BITCOIND . client . get_block_count ( ) . unwrap ( ) ;
278
278
generate_blocks ( num) ;
279
279
wait_for_block ( cur_height as usize + num) ;
280
280
}
281
281
282
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
282
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
283
283
fn generate_blocks ( num : usize ) {
284
284
let address = BITCOIND
285
285
. client
@@ -291,7 +291,7 @@ mod test {
291
291
. unwrap ( ) ;
292
292
}
293
293
294
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
294
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
295
295
fn wait_for_block ( min_height : usize ) {
296
296
let mut header = ELECTRSD . client . block_headers_subscribe ( ) . unwrap ( ) ;
297
297
loop {
@@ -306,7 +306,7 @@ mod test {
306
306
}
307
307
}
308
308
309
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
309
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
310
310
fn exponential_backoff_poll < T , F > ( mut poll : F ) -> T
311
311
where
312
312
F : FnMut ( ) -> Option < T > ,
@@ -367,7 +367,7 @@ mod test {
367
367
) ;
368
368
}
369
369
370
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
370
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
371
371
#[ tokio:: test]
372
372
async fn test_get_tx ( ) {
373
373
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -397,7 +397,7 @@ mod test {
397
397
assert_eq ! ( tx, tx_async) ;
398
398
}
399
399
400
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
400
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
401
401
#[ tokio:: test]
402
402
async fn test_get_tx_no_opt ( ) {
403
403
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -427,7 +427,7 @@ mod test {
427
427
assert_eq ! ( tx_no_opt, tx_no_opt_async) ;
428
428
}
429
429
430
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
430
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
431
431
#[ tokio:: test]
432
432
async fn test_get_tx_status ( ) {
433
433
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -458,7 +458,7 @@ mod test {
458
458
assert ! ( tx_status. confirmed) ;
459
459
}
460
460
461
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
461
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
462
462
#[ tokio:: test]
463
463
async fn test_get_header_by_hash ( ) {
464
464
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -470,7 +470,7 @@ mod test {
470
470
assert_eq ! ( block_header, block_header_async) ;
471
471
}
472
472
473
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
473
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
474
474
#[ tokio:: test]
475
475
async fn test_get_block_status ( ) {
476
476
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -490,7 +490,7 @@ mod test {
490
490
assert_eq ! ( expected, block_status_async) ;
491
491
}
492
492
493
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
493
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
494
494
#[ tokio:: test]
495
495
async fn test_get_non_existing_block_status ( ) {
496
496
// Esplora returns the same status for orphaned blocks as for non-existing blocks:
@@ -515,7 +515,7 @@ mod test {
515
515
assert_eq ! ( expected, block_status_async) ;
516
516
}
517
517
518
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
518
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
519
519
#[ tokio:: test]
520
520
async fn test_get_block_by_hash ( ) {
521
521
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -530,7 +530,7 @@ mod test {
530
530
assert_eq ! ( expected, block_async) ;
531
531
}
532
532
533
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
533
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
534
534
#[ tokio:: test]
535
535
async fn test_get_block_by_hash_not_existing ( ) {
536
536
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -546,7 +546,7 @@ mod test {
546
546
assert ! ( block_async. is_none( ) ) ;
547
547
}
548
548
549
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
549
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
550
550
#[ tokio:: test]
551
551
async fn test_get_merkle_proof ( ) {
552
552
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -577,7 +577,7 @@ mod test {
577
577
assert ! ( merkle_proof. pos > 0 ) ;
578
578
}
579
579
580
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
580
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
581
581
#[ tokio:: test]
582
582
async fn test_get_merkle_block ( ) {
583
583
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -617,7 +617,7 @@ mod test {
617
617
assert ! ( indexes[ 0 ] > 0 ) ;
618
618
}
619
619
620
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
620
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
621
621
#[ tokio:: test]
622
622
async fn test_get_output_status ( ) {
623
623
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -655,7 +655,7 @@ mod test {
655
655
assert_eq ! ( output_status, output_status_async) ;
656
656
}
657
657
658
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
658
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
659
659
#[ tokio:: test]
660
660
async fn test_get_height ( ) {
661
661
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -665,7 +665,7 @@ mod test {
665
665
assert_eq ! ( block_height, block_height_async) ;
666
666
}
667
667
668
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
668
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
669
669
#[ tokio:: test]
670
670
async fn test_get_tip_hash ( ) {
671
671
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -674,7 +674,7 @@ mod test {
674
674
assert_eq ! ( tip_hash, tip_hash_async) ;
675
675
}
676
676
677
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
677
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
678
678
#[ tokio:: test]
679
679
async fn test_get_block_hash ( ) {
680
680
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -687,7 +687,7 @@ mod test {
687
687
assert_eq ! ( block_hash, block_hash_async) ;
688
688
}
689
689
690
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
690
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
691
691
#[ tokio:: test]
692
692
async fn test_get_txid_at_block_index ( ) {
693
693
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -706,7 +706,7 @@ mod test {
706
706
assert_eq ! ( txid_at_block_index, txid_at_block_index_async) ;
707
707
}
708
708
709
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
709
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
710
710
#[ tokio:: test]
711
711
async fn test_get_fee_estimates ( ) {
712
712
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -715,7 +715,7 @@ mod test {
715
715
assert_eq ! ( fee_estimates. len( ) , fee_estimates_async. len( ) ) ;
716
716
}
717
717
718
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
718
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
719
719
#[ tokio:: test]
720
720
async fn test_scripthash_txs ( ) {
721
721
let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -763,7 +763,7 @@ mod test {
763
763
assert_eq ! ( scripthash_txs_txids, scripthash_txs_txids_async) ;
764
764
}
765
765
766
- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
766
+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
767
767
#[ tokio:: test]
768
768
async fn test_get_blocks ( ) {
769
769
let ( blocking_client, async_client) = setup_clients ( ) . await ;
0 commit comments