upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/db.cpp
diff options
context:
space:
mode:
authorBitflash <btf01@proton.me>2026-08-01 14:48:12 -0300
committerGitHub <noreply@github.com>2026-08-01 14:48:12 -0300
commitae81fa37123730982c4e054d7433c9d0c944a373 (patch)
tree771c0e5ca58c476a0a6ba1138fef3efeaf767524 /src/db.cpp
parent9da2183bb16e4c32cafbb71eeadc7f112b48ab05 (diff)
wallet: keep the default backup out of the directory it protects (#90)
Two follow-ups to #89. The default backup path was inside the data directory -- same disk, same folder the README says to copy wholesale, same folder the user eventually deletes, which is the moment the backup was for. It now defaults to the home directory and the dialog says so when a path under the data directory is chosen anyway. And nLastWalletBackup was written by the GUI, so anyone backing up with /backupwallet -- the method the README documents first -- was told forever that they had never backed up. BackupWallet records it now, so both paths count.
Diffstat (limited to 'src/db.cpp')
-rw-r--r--src/db.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 7763af8..d482c5a 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -834,6 +834,15 @@ bool BackupWallet(const string& strDest)
834 { return error("BackupWallet() : %s\n", e.what()); } 834 { return error("BackupWallet() : %s\n", e.what()); }
835 } 835 }
836 836
837 // Recorded here rather than by whoever called, so that a backup taken with
838 // /backupwallet counts as much as one taken from the GUI. When the GUI
839 // wrote this itself, anyone following the README -- which documents the
840 // command line first -- was told forever that they had never backed up.
841 // Outside the cs_db block above: this opens the wallet for writing, and
842 // there is no reason to do that while holding the database lock.
843 try { CWalletDB().WriteSetting("nLastWalletBackup", (int64)GetTime()); }
844 catch (...) { } // the backup is written; failing to note it is not fatal
845
837 printf("BackupWallet() : wrote %s\n", strDest.c_str()); 846 printf("BackupWallet() : wrote %s\n", strDest.c_str());
838 return true; 847 return true;
839} 848}