Skip to content

Commit 3ec46b6

Browse files
Merge pull request #79 from BP-WG/fix/78
Fix double-save issue
2 parents 429c853 + 2e58208 commit 3ec46b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wallet.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<K, D: Descriptor<K>, L2: Layer2Descriptor> Persisting for WalletDescr<K, D,
171171

172172
impl<K, D: Descriptor<K>, L2: Layer2Descriptor> Drop for WalletDescr<K, D, L2> {
173173
fn drop(&mut self) {
174-
if self.is_autosave() {
174+
if self.is_autosave() && self.is_dirty() {
175175
if let Err(e) = self.store() {
176176
#[cfg(feature = "log")]
177177
log::error!("impossible to automatically-save wallet descriptor on Drop: {e}");
@@ -268,7 +268,7 @@ impl<L2: Layer2Data> WalletData<L2> {
268268

269269
impl<L2: Layer2Data> Drop for WalletData<L2> {
270270
fn drop(&mut self) {
271-
if self.is_autosave() {
271+
if self.is_autosave() && self.is_dirty() {
272272
if let Err(e) = self.store() {
273273
#[cfg(feature = "log")]
274274
log::error!("impossible to automatically-save wallet data on Drop: {e}");
@@ -433,7 +433,7 @@ impl<L2: Layer2Cache> Persisting for WalletCache<L2> {
433433

434434
impl<L2: Layer2Cache> Drop for WalletCache<L2> {
435435
fn drop(&mut self) {
436-
if self.is_autosave() {
436+
if self.is_autosave() && self.is_dirty() {
437437
if let Err(e) = self.store() {
438438
#[cfg(feature = "log")]
439439
log::error!("impossible to automatically-save wallet cache on Drop: {e}");

0 commit comments

Comments
 (0)