@@ -697,7 +697,8 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
697697 } ;
698698
699699 let mut wallet = new_persisted_wallet ( network, & mut persister, & wallet_opts) ?;
700- let blockchain_client = new_blockchain_client ( & wallet_opts, & wallet) ?;
700+ let blockchain_client =
701+ new_blockchain_client ( & wallet_opts, & wallet, Some ( database_path) ) ?;
701702
702703 let result = handle_online_wallet_subcommand (
703704 & mut wallet,
@@ -773,7 +774,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
773774 let ( mut wallet, mut persister) = {
774775 let wallet_name = & wallet_opts. wallet ;
775776
776- let home_dir = prepare_home_dir ( cli_opts. datadir ) ?;
777+ let home_dir = prepare_home_dir ( cli_opts. datadir . clone ( ) ) ?;
777778
778779 let database_path = prepare_wallet_db_dir ( wallet_name, & home_dir) ?;
779780
@@ -791,6 +792,8 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
791792 } ;
792793 #[ cfg( not( any( feature = "sqlite" ) ) ) ]
793794 let mut wallet = new_wallet ( network, & wallet_opts) ?;
795+ let home_dir = prepare_home_dir ( cli_opts. datadir . clone ( ) ) ?;
796+ let database_path = prepare_wallet_db_dir ( & wallet_opts. wallet , & home_dir) ?;
794797
795798 loop {
796799 let line = readline ( ) ?;
@@ -799,7 +802,14 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
799802 continue ;
800803 }
801804
802- let result = respond ( network, & mut wallet, & wallet_opts, line) . await ;
805+ let result = respond (
806+ network,
807+ & mut wallet,
808+ & wallet_opts,
809+ line,
810+ Some ( database_path. clone ( ) ) ,
811+ )
812+ . await ;
803813 #[ cfg( feature = "sqlite" ) ]
804814 wallet. persist ( & mut persister) ?;
805815
@@ -830,6 +840,7 @@ async fn respond(
830840 wallet : & mut Wallet ,
831841 wallet_opts : & WalletOpts ,
832842 line : & str ,
843+ _datadir : Option < std:: path:: PathBuf > ,
833844) -> Result < bool , String > {
834845 use clap:: Parser ;
835846
@@ -846,7 +857,7 @@ async fn respond(
846857 subcommand : WalletSubCommand :: OnlineWalletSubCommand ( online_subcommand) ,
847858 } => {
848859 let blockchain =
849- new_blockchain_client ( wallet_opts, & wallet) . map_err ( |e| e. to_string ( ) ) ?;
860+ new_blockchain_client ( wallet_opts, & wallet, _datadir ) . map_err ( |e| e. to_string ( ) ) ?;
850861 let value = handle_online_wallet_subcommand ( wallet, blockchain, online_subcommand)
851862 . await
852863 . map_err ( |e| e. to_string ( ) ) ?;
0 commit comments