|
1 | 1 | use crate::config::{ |
2 | 2 | default_user_config, Config, BDK_CLIENT_CONCURRENCY, BDK_CLIENT_STOP_GAP, |
3 | | - DEFAULT_ESPLORA_SERVER_URL, WALLET_KEYS_SEED_LEN, |
| 3 | + DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS, DEFAULT_ESPLORA_SERVER_URL, WALLET_KEYS_SEED_LEN, |
4 | 4 | }; |
5 | 5 | use crate::connection::ConnectionManager; |
6 | 6 | use crate::event::EventQueue; |
@@ -558,10 +558,15 @@ fn build_with_store_internal( |
558 | 558 |
|
559 | 559 | let (blockchain, tx_sync, tx_broadcaster, fee_estimator) = match chain_data_source_config { |
560 | 560 | Some(ChainDataSourceConfig::Esplora(server_url)) => { |
561 | | - let tx_sync = Arc::new(EsploraSyncClient::new(server_url.clone(), Arc::clone(&logger))); |
562 | | - let blockchain = |
563 | | - EsploraBlockchain::from_client(tx_sync.client().clone(), BDK_CLIENT_STOP_GAP) |
564 | | - .with_concurrency(BDK_CLIENT_CONCURRENCY); |
| 561 | + let mut client_builder = esplora_client::Builder::new(&server_url.clone()); |
| 562 | + client_builder = client_builder.timeout(DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS); |
| 563 | + let esplora_client = client_builder.build_async().unwrap(); |
| 564 | + let tx_sync = Arc::new(EsploraSyncClient::from_client( |
| 565 | + esplora_client.clone(), |
| 566 | + Arc::clone(&logger), |
| 567 | + )); |
| 568 | + let blockchain = EsploraBlockchain::from_client(esplora_client, BDK_CLIENT_STOP_GAP) |
| 569 | + .with_concurrency(BDK_CLIENT_CONCURRENCY); |
565 | 570 | let tx_broadcaster = Arc::new(TransactionBroadcaster::new( |
566 | 571 | tx_sync.client().clone(), |
567 | 572 | Arc::clone(&logger), |
|
0 commit comments