Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double-save issue #79

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> Drop for WalletDescr<K, D, L2> {
fn drop(&mut self) {
if self.is_autosave() {
if self.is_autosave() && self.is_dirty() {

Check warning on line 174 in src/wallet.rs

View check run for this annotation

Codecov / codecov/patch

src/wallet.rs#L174

Added line #L174 was not covered by tests
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> Drop for WalletData<L2> {
fn drop(&mut self) {
if self.is_autosave() {
if self.is_autosave() && self.is_dirty() {

Check warning on line 271 in src/wallet.rs

View check run for this annotation

Codecov / codecov/patch

src/wallet.rs#L271

Added line #L271 was not covered by tests
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> Drop for WalletCache<L2> {
fn drop(&mut self) {
if self.is_autosave() {
if self.is_autosave() && self.is_dirty() {

Check warning on line 436 in src/wallet.rs

View check run for this annotation

Codecov / codecov/patch

src/wallet.rs#L436

Added line #L436 was not covered by tests
if let Err(e) = self.store() {
#[cfg(feature = "log")]
log::error!("impossible to automatically-save wallet cache on Drop: {e}");
Expand Down
Loading