@@ -25,8 +25,8 @@ use bitcoin::hashes::hex::{FromHex, ToHex};
25
25
use bitcoin:: hashes:: Hash ;
26
26
use bitcoin:: secp256k1;
27
27
use bitcoin:: {
28
- Address , Amount , PackedLockTime , Network , OutPoint , PrivateKey , Script , EcdsaSighashType , SignedAmount ,
29
- Sequence , Transaction , TxIn , TxOut , Txid , Witness ,
28
+ Address , Amount , EcdsaSighashType , Network , OutPoint , PackedLockTime , PrivateKey , Script ,
29
+ Sequence , SignedAmount , Transaction , TxIn , TxOut , Txid , Witness ,
30
30
} ;
31
31
use bitcoincore_rpc:: bitcoincore_rpc_json:: {
32
32
GetBlockTemplateModes , GetBlockTemplateRules , ScanTxOutRequest ,
@@ -119,14 +119,23 @@ fn get_auth() -> bitcoincore_rpc::Auth {
119
119
} ;
120
120
}
121
121
122
+ #[ cfg( feature = "proxy" ) ]
123
+ fn get_proxy_url ( ) -> String {
124
+ return std:: env:: var ( "PROXY_URL" ) . expect ( "PROXY_URL must be set in proxy feature" ) ;
125
+ }
126
+
122
127
fn main ( ) {
123
128
log:: set_logger ( & LOGGER ) . map ( |( ) | log:: set_max_level ( log:: LevelFilter :: max ( ) ) ) . unwrap ( ) ;
124
129
125
130
let rpc_url = format ! ( "{}/wallet/testwallet" , get_rpc_url( ) ) ;
126
131
let auth = get_auth ( ) ;
127
132
133
+ #[ cfg( not( feature = "proxy" ) ) ]
128
134
let cl = Client :: new ( & rpc_url, auth) . unwrap ( ) ;
129
135
136
+ #[ cfg( feature = "proxy" ) ]
137
+ let cl = Client :: new_with_proxy ( & rpc_url, auth, & get_proxy_url ( ) , None ) . unwrap ( ) ;
138
+
130
139
test_get_network_info ( & cl) ;
131
140
unsafe { VERSION = cl. version ( ) . unwrap ( ) } ;
132
141
println ! ( "Version: {}" , version( ) ) ;
0 commit comments