Skip to content

Commit

Permalink
Merge pull request #79 from BP-WG/fix/78
Browse files Browse the repository at this point in the history
Fix double-save issue
  • Loading branch information
Crayon-Shin-chan-bitlightlabs authored Jan 2, 2025
2 parents 429c853 + 2e58208 commit 3ec46b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl<K, D: Descriptor<K>, L2: Layer2Descriptor> Persisting for WalletDescr<K, D,

impl<K, D: Descriptor<K>, L2: Layer2Descriptor> Drop for WalletDescr<K, D, L2> {
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}");
Expand Down Expand Up @@ -268,7 +268,7 @@ impl<L2: Layer2Data> WalletData<L2> {

impl<L2: Layer2Data> Drop for WalletData<L2> {
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}");
Expand Down Expand Up @@ -433,7 +433,7 @@ impl<L2: Layer2Cache> Persisting for WalletCache<L2> {

impl<L2: Layer2Cache> Drop for WalletCache<L2> {
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}");
Expand Down

0 comments on commit 3ec46b6

Please sign in to comment.