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}");