@@ -455,7 +455,7 @@ impl Session<Error> for ElectrumSession {
455
455
notify_block ( self . notify . clone ( ) , tip_height) ;
456
456
457
457
info ! ( "building client" ) ;
458
- if let Ok ( fee_client) = self . url . build_client ( ) {
458
+ if let Ok ( fee_client) = self . url . build_client ( self . proxy . as_deref ( ) ) {
459
459
info ! ( "building built end" ) ;
460
460
let fee_store = store. clone ( ) ;
461
461
thread:: spawn ( move || {
@@ -492,6 +492,7 @@ impl Session<Error> for ElectrumSession {
492
492
} ;
493
493
494
494
let headers_url = self . url . clone ( ) ;
495
+ let proxy = self . proxy . clone ( ) ;
495
496
let ( close_headers, r) = channel ( ) ;
496
497
self . closer . senders . push ( close_headers) ;
497
498
let notify_headers = self . notify . clone ( ) ;
@@ -506,7 +507,7 @@ impl Session<Error> for ElectrumSession {
506
507
break ;
507
508
}
508
509
509
- if let Ok ( client) = headers_url. build_client ( ) {
510
+ if let Ok ( client) = headers_url. build_client ( proxy . as_deref ( ) ) {
510
511
loop {
511
512
if r. try_recv ( ) . is_ok ( ) {
512
513
info ! ( "closing headers thread" ) ;
@@ -579,7 +580,7 @@ impl Session<Error> for ElectrumSession {
579
580
580
581
// Recover BIP 44 accounts on the first login
581
582
if !store. read ( ) . unwrap ( ) . cache . accounts_recovered {
582
- wallet. write ( ) . unwrap ( ) . recover_accounts ( & self . url ) ?;
583
+ wallet. write ( ) . unwrap ( ) . recover_accounts ( & self . url , self . proxy . as_deref ( ) ) ?;
583
584
store. write ( ) . unwrap ( ) . cache . accounts_recovered = true ;
584
585
}
585
586
@@ -602,10 +603,11 @@ impl Session<Error> for ElectrumSession {
602
603
let ( close_tipper, r) = channel ( ) ;
603
604
self . closer . senders . push ( close_tipper) ;
604
605
let tipper_url = self . url . clone ( ) ;
606
+ let proxy = self . proxy . clone ( ) ;
605
607
let tipper_handle = thread:: spawn ( move || {
606
608
info ! ( "starting tipper thread" ) ;
607
609
loop {
608
- if let Ok ( client) = tipper_url. build_client ( ) {
610
+ if let Ok ( client) = tipper_url. build_client ( proxy . as_deref ( ) ) {
609
611
match tipper. tip ( & client) {
610
612
Ok ( current_tip) => {
611
613
if tip_height != current_tip {
@@ -631,10 +633,11 @@ impl Session<Error> for ElectrumSession {
631
633
self . closer . senders . push ( close_syncer) ;
632
634
let notify_txs = self . notify . clone ( ) ;
633
635
let syncer_url = self . url . clone ( ) ;
636
+ let proxy = self . proxy . clone ( ) ;
634
637
let syncer_handle = thread:: spawn ( move || {
635
638
info ! ( "starting syncer thread" ) ;
636
639
loop {
637
- match syncer_url. build_client ( ) {
640
+ match syncer_url. build_client ( proxy . as_deref ( ) ) {
638
641
Ok ( client) => match syncer. sync ( & client) {
639
642
Ok ( updated_accounts) => {
640
643
for account_num in updated_accounts {
@@ -764,7 +767,7 @@ impl Session<Error> for ElectrumSession {
764
767
765
768
fn send_transaction ( & mut self , tx : & TransactionMeta ) -> Result < String , Error > {
766
769
info ! ( "electrum send_transaction {:#?}" , tx) ;
767
- let client = self . url . build_client ( ) ?;
770
+ let client = self . url . build_client ( self . proxy . as_deref ( ) ) ?;
768
771
let tx_bytes = hex:: decode ( & tx. hex ) ?;
769
772
let txid = client. transaction_broadcast_raw ( & tx_bytes) ?;
770
773
Ok ( format ! ( "{}" , txid) )
@@ -774,7 +777,7 @@ impl Session<Error> for ElectrumSession {
774
777
let transaction = BETransaction :: from_hex ( & tx_hex, self . network . id ( ) ) ?;
775
778
776
779
info ! ( "broadcast_transaction {:#?}" , transaction. txid( ) ) ;
777
- let client = self . url . build_client ( ) ?;
780
+ let client = self . url . build_client ( self . proxy . as_deref ( ) ) ?;
778
781
let hex = hex:: decode ( tx_hex) ?;
779
782
let txid = client. transaction_broadcast_raw ( & hex) ?;
780
783
Ok ( format ! ( "{}" , txid) )
@@ -790,7 +793,7 @@ impl Session<Error> for ElectrumSession {
790
793
NetworkId :: Bitcoin ( _) => 1000 ,
791
794
NetworkId :: Elements ( _) => 100 ,
792
795
} ;
793
- let fee_estimates = try_get_fee_estimates ( & self . url . build_client ( ) ?)
796
+ let fee_estimates = try_get_fee_estimates ( & self . url . build_client ( self . proxy . as_deref ( ) ) ?)
794
797
. unwrap_or_else ( |_| vec ! [ FeeEstimate ( min_fee) ; 25 ] ) ;
795
798
self . get_wallet ( ) ?. store . write ( ) ?. cache . fee_estimates = fee_estimates. clone ( ) ;
796
799
Ok ( fee_estimates)
0 commit comments