mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-11-12 01:37:02 +00:00
Add guards around updating memo, save wallet
This commit is contained in:
@@ -342,6 +342,9 @@ impl LightClient {
|
||||
info!("Created new wallet with a new seed!");
|
||||
info!("Created LightClient to {}", &config.server);
|
||||
|
||||
// Save
|
||||
l.do_save().map_err(|s| io::Error::new(ErrorKind::PermissionDenied, s))?;
|
||||
|
||||
Ok(l)
|
||||
}
|
||||
|
||||
@@ -367,6 +370,9 @@ impl LightClient {
|
||||
info!("Created new wallet!");
|
||||
info!("Created LightClient to {}", &config.server);
|
||||
|
||||
// Save
|
||||
l.do_save().map_err(|s| io::Error::new(ErrorKind::PermissionDenied, s))?;
|
||||
|
||||
Ok(l)
|
||||
}
|
||||
|
||||
@@ -576,14 +582,18 @@ impl LightClient {
|
||||
1_000_000, // 1 MB write buffer
|
||||
File::create(self.config.get_wallet_path()).unwrap());
|
||||
|
||||
match self.wallet.write().unwrap().write(&mut file_buffer) {
|
||||
let r = match self.wallet.write().unwrap().write(&mut file_buffer) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => {
|
||||
let err = format!("ERR: {}", e);
|
||||
error!("{}", err);
|
||||
Err(e.to_string())
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
file_buffer.flush().map_err(|e| format!("{}", e))?;
|
||||
|
||||
r
|
||||
}
|
||||
|
||||
pub fn get_server_uri(&self) -> http::Uri {
|
||||
|
||||
Reference in New Issue
Block a user