Skip to content

Commit 715ff37

Browse files
committed
Fix #2172.
1 parent ea22806 commit 715ff37

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

massa-client/src/cmds.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,11 @@ impl Command {
471471
let mut res = "".to_string();
472472
for key in parse_vec::<Address>(parameters)?.into_iter() {
473473
match wallet.remove_address(key) {
474-
Some(_) => {
474+
Ok(_) => {
475475
res.push_str(&format!("Removed address {} from the wallet\n", key));
476476
}
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());
479479
}
480480
}
481481
}

massa-wallet/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ impl Wallet {
7777
}
7878
}
7979

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()
8283
}
8384

8485
/// Finds the private key associated with given address

0 commit comments

Comments
 (0)