@@ -26,7 +26,14 @@ use bdk_wallet::bitcoin::bip32::{DerivationPath, KeySource};
2626use bdk_wallet:: bitcoin:: consensus:: encode:: { serialize, serialize_hex} ;
2727use bdk_wallet:: bitcoin:: script:: PushBytesBuf ;
2828use bdk_wallet:: bitcoin:: Network ;
29- use bdk_wallet:: bitcoin:: { secp256k1:: Secp256k1 , Transaction , Txid } ;
29+ #[ cfg( any(
30+ feature = "electrum" ,
31+ feature = "esplora" ,
32+ feature = "cbf" ,
33+ feature = "rpc"
34+ ) ) ]
35+ use bdk_wallet:: bitcoin:: Transaction ;
36+ use bdk_wallet:: bitcoin:: { secp256k1:: Secp256k1 , Txid } ;
3037use bdk_wallet:: bitcoin:: { Amount , FeeRate , Psbt , Sequence } ;
3138use bdk_wallet:: descriptor:: Segwitv0 ;
3239use bdk_wallet:: keys:: bip39:: WordCount ;
@@ -43,15 +50,35 @@ use bdk_wallet::keys::DescriptorKey::Secret;
4350use bdk_wallet:: keys:: { DerivableKey , DescriptorKey , ExtendedKey , GeneratableKey , GeneratedKey } ;
4451use bdk_wallet:: miniscript:: miniscript;
4552use serde_json:: json;
46- use std:: collections:: { BTreeMap , HashSet } ;
53+ use std:: collections:: BTreeMap ;
54+ #[ cfg( any(
55+ feature = "electrum" ,
56+ feature = "esplora" ,
57+ feature = "cbf" ,
58+ feature = "rpc"
59+ ) ) ]
60+ use std:: collections:: HashSet ;
4761use std:: convert:: TryFrom ;
62+ #[ cfg( feature = "repl" ) ]
4863use std:: io:: Write ;
4964use std:: str:: FromStr ;
5065
5166#[ cfg( feature = "electrum" ) ]
5267use crate :: utils:: BlockchainClient :: Electrum ;
5368use bdk_wallet:: bitcoin:: base64:: prelude:: * ;
69+ #[ cfg( any(
70+ feature = "electrum" ,
71+ feature = "esplora" ,
72+ feature = "cbf" ,
73+ feature = "rpc"
74+ ) ) ]
5475use bdk_wallet:: bitcoin:: consensus:: Decodable ;
76+ #[ cfg( any(
77+ feature = "electrum" ,
78+ feature = "esplora" ,
79+ feature = "cbf" ,
80+ feature = "rpc"
81+ ) ) ]
5582use bdk_wallet:: bitcoin:: hex:: FromHex ;
5683#[ cfg( feature = "esplora" ) ]
5784use { crate :: utils:: BlockchainClient :: Esplora , bdk_esplora:: EsploraAsyncExt } ;
@@ -385,7 +412,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
385412 hash : genesis_block. block_hash ( ) ,
386413 } ) ;
387414 let mut emitter =
388- Emitter :: new ( & client, genesis_cp. clone ( ) , genesis_cp. height ( ) ) ;
415+ Emitter :: new ( & * client, genesis_cp. clone ( ) , genesis_cp. height ( ) ) ;
389416
390417 while let Some ( block_event) = emitter. next_block ( ) ? {
391418 wallet. apply_block_connected_to (
@@ -433,7 +460,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
433460 #[ cfg( feature = "rpc" ) ]
434461 RpcClient { client } => {
435462 let wallet_cp = wallet. latest_checkpoint ( ) ;
436- let mut emitter = Emitter :: new ( & client, wallet_cp. clone ( ) , wallet_cp. height ( ) ) ;
463+ let mut emitter = Emitter :: new ( & * client, wallet_cp. clone ( ) , wallet_cp. height ( ) ) ;
437464
438465 while let Some ( block_event) = emitter. next_block ( ) ? {
439466 wallet. apply_block_connected_to (
@@ -482,7 +509,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
482509 } => client
483510 . broadcast ( & tx)
484511 . await
485- . map ( |( ) | tx. compute_txid ( ) . clone ( ) )
512+ . map ( |( ) | tx. compute_txid ( ) )
486513 . map_err ( |e| Error :: Generic ( e. to_string ( ) ) ) ?,
487514 #[ cfg( feature = "rpc" ) ]
488515 RpcClient { client } => client
@@ -636,7 +663,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
636663 } => {
637664 let blockchain_client = new_blockchain_client ( & wallet_opts) ?;
638665 let network = cli_opts. network ;
639- #[ cfg( any ( feature = "sqlite" ) ) ]
666+ #[ cfg( feature = "sqlite" ) ]
640667 let result = {
641668 let home_dir = prepare_home_dir ( cli_opts. datadir ) ?;
642669 let wallet_name = & wallet_opts. wallet ;
@@ -674,7 +701,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
674701 subcommand : WalletSubCommand :: OfflineWalletSubCommand ( offline_subcommand) ,
675702 } => {
676703 let network = cli_opts. network ;
677- #[ cfg( any ( feature = "sqlite" ) ) ]
704+ #[ cfg( feature = "sqlite" ) ]
678705 let result = {
679706 let home_dir = prepare_home_dir ( cli_opts. datadir ) ?;
680707 let wallet_name = & wallet_opts. wallet ;
@@ -722,7 +749,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
722749 #[ cfg( feature = "repl" ) ]
723750 CliSubCommand :: Repl { wallet_opts } => {
724751 let network = cli_opts. network ;
725- #[ cfg( any ( feature = "sqlite" ) ) ]
752+ #[ cfg( feature = "sqlite" ) ]
726753 let ( mut wallet, mut persister) = {
727754 let wallet_name = & wallet_opts. wallet ;
728755
@@ -753,7 +780,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
753780 }
754781
755782 let result = respond ( network, & mut wallet, & wallet_opts, line) . await ;
756- #[ cfg( any ( feature = "sqlite" ) ) ]
783+ #[ cfg( feature = "sqlite" ) ]
757784 wallet. persist ( & mut persister) ?;
758785
759786 match result {
@@ -798,7 +825,7 @@ async fn respond(
798825 ReplSubCommand :: Wallet {
799826 subcommand : WalletSubCommand :: OnlineWalletSubCommand ( online_subcommand) ,
800827 } => {
801- let blockchain = new_blockchain_client ( & wallet_opts) . map_err ( |e| e. to_string ( ) ) ?;
828+ let blockchain = new_blockchain_client ( wallet_opts) . map_err ( |e| e. to_string ( ) ) ?;
802829 let value = handle_online_wallet_subcommand ( wallet, blockchain, online_subcommand)
803830 . await
804831 . map_err ( |e| e. to_string ( ) ) ?;
0 commit comments