@@ -744,25 +744,23 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
744744 feature = "rpc"
745745 ) ) ]
746746 CliSubCommand :: Wallet {
747- wallet_opts,
747+ mut wallet_opts,
748748 subcommand : WalletSubCommand :: OnlineWalletSubCommand ( online_subcommand) ,
749749 } => {
750750 let network = cli_opts. network ;
751751 let home_dir = prepare_home_dir ( cli_opts. datadir ) ?;
752752 let wallet_name = & wallet_opts. wallet ;
753- let database_path =
754- prepare_wallet_db_dir ( wallet_name, & home_dir, & mut wallet_opts. clone ( ) ) ?;
753+ let database_path = prepare_wallet_db_dir ( & home_dir, & mut wallet_opts) ?;
755754 #[ cfg( feature = "sqlite" ) ]
756755 let result = {
757756 let mut persister = match & wallet_opts. database_type {
758- #[ cfg( feature = "sqlite" ) ]
759757 Some ( DatabaseType :: Sqlite ) => {
760758 let db_file = database_path. join ( "wallet.sqlite" ) ;
761759 let connection = Connection :: open ( db_file) ?;
762760 log:: debug!( "Sqlite database opened successfully" ) ;
763761 connection
764- } ,
765- None => return Err ( Error :: Generic ( "Dataase type is required" . to_string ( ) ) ) ,
762+ }
763+ None => return Err ( Error :: Generic ( "Dataase type is required" . to_string ( ) ) ) ,
766764 } ;
767765
768766 let mut wallet = new_persisted_wallet ( network, & mut persister, & wallet_opts) ?;
@@ -790,25 +788,22 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
790788 serde_json:: to_string_pretty ( & result)
791789 }
792790 CliSubCommand :: Wallet {
793- wallet_opts,
791+ mut wallet_opts,
794792 subcommand : WalletSubCommand :: OfflineWalletSubCommand ( offline_subcommand) ,
795793 } => {
796794 let network = cli_opts. network ;
797795 #[ cfg( feature = "sqlite" ) ]
798796 let result = {
799797 let home_dir = prepare_home_dir ( cli_opts. datadir ) ?;
800- let wallet_name = & wallet_opts. wallet ;
801- let database_path =
802- prepare_wallet_db_dir ( wallet_name, & home_dir, & mut wallet_opts. clone ( ) ) ?;
798+ let database_path = prepare_wallet_db_dir ( & home_dir, & mut wallet_opts) ?;
803799 let mut persister = match & wallet_opts. database_type {
804- #[ cfg( feature = "sqlite" ) ]
805800 Some ( DatabaseType :: Sqlite ) => {
806801 let db_file = database_path. join ( "wallet.sqlite" ) ;
807802 let connection = Connection :: open ( db_file) ?;
808803 log:: debug!( "Sqlite database opened successfully" ) ;
809804 connection
810- } ,
811- None => return Err ( Error :: Generic ( "Databas type is required" . to_string ( ) ) ) ,
805+ }
806+ None => return Err ( Error :: Generic ( "Database type is required" . to_string ( ) ) ) ,
812807 } ;
813808
814809 let mut wallet = new_persisted_wallet ( network, & mut persister, & wallet_opts) ?;
@@ -846,12 +841,8 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
846841 let network = cli_opts. network ;
847842 #[ cfg( feature = "sqlite" ) ]
848843 let ( mut wallet, mut persister) = {
849- let wallet_name = & wallet_opts. wallet ;
850-
851844 let home_dir = prepare_home_dir ( cli_opts. datadir . clone ( ) ) ?;
852-
853- let database_path =
854- prepare_wallet_db_dir ( wallet_name, & home_dir, & mut wallet_opts. clone ( ) ) ?;
845+ let database_path = prepare_wallet_db_dir ( & home_dir, & mut wallet_opts. clone ( ) ) ?;
855846
856847 let mut persister = match & wallet_opts. database_type {
857848 #[ cfg( feature = "sqlite" ) ]
@@ -860,7 +851,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
860851 let connection = Connection :: open ( db_file) ?;
861852 log:: debug!( "Sqlite database opened successfully" ) ;
862853 connection
863- } ,
854+ }
864855 None => return Err ( Error :: Generic ( "Database typ is required" . to_string ( ) ) ) ,
865856 } ;
866857 let wallet = new_persisted_wallet ( network, & mut persister, & wallet_opts) ?;
@@ -869,8 +860,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
869860 #[ cfg( not( any( feature = "sqlite" ) ) ) ]
870861 let mut wallet = new_wallet ( network, & wallet_opts) ?;
871862 let home_dir = prepare_home_dir ( cli_opts. datadir . clone ( ) ) ?;
872- let database_path =
873- prepare_wallet_db_dir ( & wallet_opts. wallet , & home_dir, & mut wallet_opts. clone ( ) ) ?;
863+ let database_path = prepare_wallet_db_dir ( & home_dir, & mut wallet_opts. clone ( ) ) ?;
874864 loop {
875865 let line = readline ( ) ?;
876866 let line = line. trim ( ) ;
0 commit comments