From 2e58208de9251ccc16cec77be75e97ea166e2997 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Wed, 1 Jan 2025 11:06:26 +0100 Subject: [PATCH] wallet: fix double-save Closes #78 --- src/wallet.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet.rs b/src/wallet.rs index b051ebd..214e180 100644 --- a/src/wallet.rs +++ b/src/wallet.rs @@ -171,7 +171,7 @@ impl, L2: Layer2Descriptor> Persisting for WalletDescr, L2: Layer2Descriptor> Drop for WalletDescr { fn drop(&mut self) { - if self.is_autosave() { + if self.is_autosave() && self.is_dirty() { if let Err(e) = self.store() { #[cfg(feature = "log")] log::error!("impossible to automatically-save wallet descriptor on Drop: {e}"); @@ -268,7 +268,7 @@ impl WalletData { impl Drop for WalletData { fn drop(&mut self) { - if self.is_autosave() { + if self.is_autosave() && self.is_dirty() { if let Err(e) = self.store() { #[cfg(feature = "log")] log::error!("impossible to automatically-save wallet data on Drop: {e}"); @@ -433,7 +433,7 @@ impl Persisting for WalletCache { impl Drop for WalletCache { fn drop(&mut self) { - if self.is_autosave() { + if self.is_autosave() && self.is_dirty() { if let Err(e) = self.store() { #[cfg(feature = "log")] log::error!("impossible to automatically-save wallet cache on Drop: {e}");