@@ -124,7 +124,15 @@ use bdk::bitcoin::secp256k1::Secp256k1;
124124use bdk:: bitcoin:: util:: bip32:: { DerivationPath , ExtendedPrivKey , KeySource } ;
125125use bdk:: bitcoin:: util:: psbt:: PartiallySignedTransaction ;
126126use bdk:: bitcoin:: { Address , Network , OutPoint , Script , Txid } ;
127- #[ cfg( feature = "reserves" ) ]
127+ #[ cfg( all(
128+ feature = "reserves" ,
129+ any(
130+ feature = "electrum" ,
131+ feature = "esplora" ,
132+ feature = "compact_filters" ,
133+ feature = "rpc"
134+ )
135+ ) ) ]
128136use bdk:: blockchain:: Capability ;
129137#[ cfg( any(
130138 feature = "electrum" ,
@@ -1136,12 +1144,11 @@ where
11361144 } => {
11371145 let psbt = base64:: decode ( & psbt) . unwrap ( ) ;
11381146 let psbt: PartiallySignedTransaction = deserialize ( & psbt) . unwrap ( ) ;
1139- let current_height = wallet . client ( ) . get_height ( ) ?;
1147+ let current_height = blockchain . get_height ( ) ?;
11401148 let max_confirmation_height = if confirmations == 0 {
11411149 None
11421150 } else {
1143- if !wallet
1144- . client ( )
1151+ if !blockchain
11451152 . get_capabilities ( )
11461153 . contains ( & Capability :: GetAnyTx )
11471154 {
@@ -1421,14 +1428,14 @@ mod test {
14211428 use bdk:: miniscript:: bitcoin:: network:: constants:: Network :: Testnet ;
14221429 #[ cfg( all( feature = "reserves" , feature = "electrum" ) ) ]
14231430 use bdk:: {
1424- blockchain:: { noop_progress, ElectrumBlockchain } ,
1425- database:: MemoryDatabase ,
1426- electrum_client:: Client ,
1427- Wallet ,
1431+ blockchain:: ElectrumBlockchain , database:: MemoryDatabase , electrum_client:: Client , Wallet ,
14281432 } ;
14291433 use std:: str:: { self , FromStr } ;
14301434 use structopt:: StructOpt ;
14311435
1436+ #[ cfg( all( feature = "reserves" , feature = "electrum" , ) ) ]
1437+ use crate :: bdk:: SyncOptions ;
1438+
14321439 #[ test]
14331440 fn test_parse_wallet_get_new_address ( ) {
14341441 let cli_args = vec ! [ "bdk-cli" , "--network" , "bitcoin" , "wallet" ,
@@ -2279,16 +2286,16 @@ mod test {
22792286 let message = "Those coins belong to Satoshi Nakamoto" ;
22802287
22812288 let client = Client :: new ( "ssl://electrum.blockstream.info:60002" ) . unwrap ( ) ;
2289+ let blockchain = ElectrumBlockchain :: from ( client) ;
22822290 let wallet = Wallet :: new (
22832291 & descriptor,
22842292 None ,
22852293 Network :: Testnet ,
22862294 MemoryDatabase :: default ( ) ,
2287- ElectrumBlockchain :: from ( client) ,
22882295 )
22892296 . unwrap ( ) ;
22902297
2291- wallet. sync ( noop_progress ( ) , None ) . unwrap ( ) ;
2298+ wallet. sync ( & blockchain , SyncOptions :: default ( ) ) . unwrap ( ) ;
22922299 let balance = wallet. get_balance ( ) . unwrap ( ) ;
22932300
22942301 let addr = wallet. get_address ( bdk:: wallet:: AddressIndex :: New ) . unwrap ( ) ;
@@ -2317,7 +2324,7 @@ mod test {
23172324 } => online_subcommand,
23182325 _ => panic ! ( "unexpected subcommand" ) ,
23192326 } ;
2320- let result = handle_online_wallet_subcommand ( & wallet, wallet_subcmd) . unwrap ( ) ;
2327+ let result = handle_online_wallet_subcommand ( & wallet, & blockchain , wallet_subcmd) . unwrap ( ) ;
23212328 let psbt: PartiallySignedTransaction =
23222329 serde_json:: from_str ( & result. as_object ( ) . unwrap ( ) . get ( "psbt" ) . unwrap ( ) . to_string ( ) )
23232330 . unwrap ( ) ;
@@ -2355,7 +2362,7 @@ mod test {
23552362 } => online_subcommand,
23562363 _ => panic ! ( "unexpected subcommand" ) ,
23572364 } ;
2358- let result = handle_online_wallet_subcommand ( & wallet, wallet_subcmd) . unwrap ( ) ;
2365+ let result = handle_online_wallet_subcommand ( & wallet, & blockchain , wallet_subcmd) . unwrap ( ) ;
23592366 let spendable = result
23602367 . as_object ( )
23612368 . unwrap ( )
0 commit comments