File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -471,11 +471,11 @@ impl Command {
471
471
let mut res = "" . to_string ( ) ;
472
472
for key in parse_vec :: < Address > ( parameters) ?. into_iter ( ) {
473
473
match wallet. remove_address ( key) {
474
- Some ( _) => {
474
+ Ok ( _) => {
475
475
res. push_str ( & format ! ( "Removed address {} from the wallet\n " , key) ) ;
476
476
}
477
- None => {
478
- res. push_str ( & format ! ( "Address {} wasn't in the wallet \n " , key ) ) ;
477
+ Err ( err ) => {
478
+ res. push_str ( & err . to_string ( ) ) ;
479
479
}
480
480
}
481
481
}
Original file line number Diff line number Diff line change @@ -77,8 +77,9 @@ impl Wallet {
77
77
}
78
78
}
79
79
80
- pub fn remove_address ( & mut self , address : Address ) -> Option < ( PublicKey , PrivateKey ) > {
81
- self . keys . remove ( & address)
80
+ pub fn remove_address ( & mut self , address : Address ) -> Result < ( ) , WalletError > {
81
+ self . keys . remove ( & address) . ok_or ( WalletError :: MissingKeyError ( address) ) ?;
82
+ self . save ( )
82
83
}
83
84
84
85
/// Finds the private key associated with given address
You can’t perform that action at this time.
0 commit comments