wallet: clear data on sync error

This commit is contained in:
ardocrat 2023-11-05 00:46:52 +03:00
parent 03fa6a479e
commit 0926d37428

View file

@ -419,6 +419,12 @@ impl Wallet {
/// Set an error for wallet on synchronization.
fn set_sync_error(&self, error: bool) {
// Clear wallet info on error.
if error {
let mut w_data = self.data.write().unwrap();
*w_data = None;
}
self.sync_error.store(error, Ordering::Relaxed);
}
@ -947,7 +953,7 @@ fn repair_wallet(wallet: &Wallet) {
wallet.repair_needed.store(false, Ordering::Relaxed);
}
}
Err(e) => {
Err(_) => {
// Set sync error if wallet is open.
if wallet.is_open() {
wallet.set_sync_error(true);