@@ -87,6 +87,7 @@ const LSPS_HARDENED_CHILD_INDEX: u32 = 577;
87
87
enum ChainDataSourceConfig {
88
88
Esplora {
89
89
server_url : String ,
90
+ headers : HashMap < String , String > ,
90
91
sync_config : Option < EsploraSyncConfig > ,
91
92
} ,
92
93
Electrum {
@@ -294,9 +295,28 @@ impl NodeBuilder {
294
295
/// information.
295
296
pub fn set_chain_source_esplora (
296
297
& mut self , server_url : String , sync_config : Option < EsploraSyncConfig > ,
298
+ ) -> & mut Self {
299
+ self . chain_data_source_config = Some ( ChainDataSourceConfig :: Esplora {
300
+ server_url,
301
+ headers : Default :: default ( ) ,
302
+ sync_config,
303
+ } ) ;
304
+ self
305
+ }
306
+
307
+ /// Configures the [`Node`] instance to source its chain data from the given Esplora server.
308
+ ///
309
+ /// The given `headers` will be included in all requests to the Esplora server, typically used for
310
+ /// authentication purposes.
311
+ ///
312
+ /// If no `sync_config` is given, default values are used. See [`EsploraSyncConfig`] for more
313
+ /// information.
314
+ pub fn set_chain_source_esplora_with_headers (
315
+ & mut self , server_url : String , headers : HashMap < String , String > ,
316
+ sync_config : Option < EsploraSyncConfig > ,
297
317
) -> & mut Self {
298
318
self . chain_data_source_config =
299
- Some ( ChainDataSourceConfig :: Esplora { server_url, sync_config } ) ;
319
+ Some ( ChainDataSourceConfig :: Esplora { server_url, headers , sync_config } ) ;
300
320
self
301
321
}
302
322
@@ -754,6 +774,24 @@ impl ArcedNodeBuilder {
754
774
self . inner . write ( ) . unwrap ( ) . set_chain_source_esplora ( server_url, sync_config) ;
755
775
}
756
776
777
+ /// Configures the [`Node`] instance to source its chain data from the given Esplora server.
778
+ ///
779
+ /// The given `headers` will be included in all requests to the Esplora server, typically used for
780
+ /// authentication purposes.
781
+ ///
782
+ /// If no `sync_config` is given, default values are used. See [`EsploraSyncConfig`] for more
783
+ /// information.
784
+ pub fn set_chain_source_esplora_with_headers (
785
+ & self , server_url : String , headers : HashMap < String , String > ,
786
+ sync_config : Option < EsploraSyncConfig > ,
787
+ ) {
788
+ self . inner . write ( ) . unwrap ( ) . set_chain_source_esplora_with_headers (
789
+ server_url,
790
+ headers,
791
+ sync_config,
792
+ ) ;
793
+ }
794
+
757
795
/// Configures the [`Node`] instance to source its chain data from the given Electrum server.
758
796
///
759
797
/// If no `sync_config` is given, default values are used. See [`ElectrumSyncConfig`] for more
@@ -1117,10 +1155,11 @@ fn build_with_store_internal(
1117
1155
) ) ;
1118
1156
1119
1157
let chain_source = match chain_data_source_config {
1120
- Some ( ChainDataSourceConfig :: Esplora { server_url, sync_config } ) => {
1158
+ Some ( ChainDataSourceConfig :: Esplora { server_url, headers , sync_config } ) => {
1121
1159
let sync_config = sync_config. unwrap_or ( EsploraSyncConfig :: default ( ) ) ;
1122
1160
Arc :: new ( ChainSource :: new_esplora (
1123
1161
server_url. clone ( ) ,
1162
+ headers. clone ( ) ,
1124
1163
sync_config,
1125
1164
Arc :: clone ( & wallet) ,
1126
1165
Arc :: clone ( & fee_estimator) ,
@@ -1187,6 +1226,7 @@ fn build_with_store_internal(
1187
1226
let sync_config = EsploraSyncConfig :: default ( ) ;
1188
1227
Arc :: new ( ChainSource :: new_esplora (
1189
1228
server_url. clone ( ) ,
1229
+ HashMap :: new ( ) ,
1190
1230
sync_config,
1191
1231
Arc :: clone ( & wallet) ,
1192
1232
Arc :: clone ( & fee_estimator) ,
0 commit comments