diff options
| author | bitflash <dev@bitflash.network> | 2026-08-19 09:30:40 -0300 |
|---|---|---|
| committer | bitflash <dev@bitflash.network> | 2026-08-19 09:30:40 -0300 |
| commit | cf155d40ddd260975240e72b5e72cd3decc30291 (patch) | |
| tree | 9bc019064bd14e49acb0845929295f6529e0b056 /src | |
| parent | 8a47568dcfec8869bc08c555f0070be2d7ddddce (diff) | |
gui/wallet: name backups by backend, and stop saying "wallet.dat" for phrase gaps
Two things that read wrong once the wallet is on SQLite:
- The Wallet Safety backup dialog defaulted the file name to .dat, but
BackupWallet copies wallet.sqlite under the SQLite backend -- so the
suggested name put SQLite contents in a wallet-backup-*.dat file. The
default now matches the live backend (.sqlite on SQLite, .dat on BDB).
- The recovery audit called coins on non-phrase keys "wallet.dat-only" and
told the user to "keep wallet.dat backups". Under SQLite those coins live
in wallet.sqlite, not wallet.dat. Reworded to the backend-neutral truth:
"not phrase-backed" balance, and "keep a file backup of this wallet" --
accurate on either backend. Same wording in the CLI -recoveryaudit and
the GUI Wallet Safety panel.
Display/naming only; audit numbers and BackupWallet are unchanged. All 13
wallet suites still pass.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gui.cpp | 14 | ||||
| -rw-r--r-- | src/walletcmd.cpp | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/gui.cpp b/src/gui.cpp index 81dd8e0..672f0ff 100644 --- a/src/gui.cpp +++ b/src/gui.cpp | |||
| @@ -175,7 +175,11 @@ static bool PathIsInsideDataDir(const std::string& strPath) | |||
| 175 | 175 | ||
| 176 | static void SetDefaultBackupPath() | 176 | static void SetDefaultBackupPath() |
| 177 | { | 177 | { |
| 178 | std::string path = DefaultBackupDir() + "/wallet-backup-" + BackupTimeSuffix() + ".dat"; | 178 | // Match the extension to the live backend: BackupWallet copies wallet.sqlite |
| 179 | // under the SQLite backend and wallet.dat under Berkeley DB, so a ".dat" | ||
| 180 | // default name would put SQLite contents in a misleadingly-named file. | ||
| 181 | const char* pszExt = WalletSQLiteRuntimeActive() ? ".sqlite" : ".dat"; | ||
| 182 | std::string path = DefaultBackupDir() + "/wallet-backup-" + BackupTimeSuffix() + pszExt; | ||
| 179 | strncpy(g_backupPath, path.c_str(), sizeof(g_backupPath)-1); | 183 | strncpy(g_backupPath, path.c_str(), sizeof(g_backupPath)-1); |
| 180 | g_backupPath[sizeof(g_backupPath)-1] = '\0'; | 184 | g_backupPath[sizeof(g_backupPath)-1] = '\0'; |
| 181 | } | 185 | } |
| @@ -1257,11 +1261,11 @@ static void DrawWalletSafetyDialog() | |||
| 1257 | } | 1261 | } |
| 1258 | ImGui::Text("Phrase-backed spendable balance: %s BTF", | 1262 | ImGui::Text("Phrase-backed spendable balance: %s BTF", |
| 1259 | FmtMoney(g_recoveryAudit.nRecoverableCredit).c_str()); | 1263 | FmtMoney(g_recoveryAudit.nRecoverableCredit).c_str()); |
| 1260 | ImGui::Text("Wallet.dat-only spendable balance: %s BTF", | 1264 | ImGui::Text("Not phrase-backed spendable balance: %s BTF", |
| 1261 | FmtMoney(g_recoveryAudit.nLegacyCredit).c_str()); | 1265 | FmtMoney(g_recoveryAudit.nLegacyCredit).c_str()); |
| 1262 | ImGui::Text("Phrase-backed immature mining rewards: %s BTF", | 1266 | ImGui::Text("Phrase-backed immature mining rewards: %s BTF", |
| 1263 | FmtMoney(g_recoveryAudit.nRecoverableImmatureCredit).c_str()); | 1267 | FmtMoney(g_recoveryAudit.nRecoverableImmatureCredit).c_str()); |
| 1264 | ImGui::Text("Wallet.dat-only immature mining rewards: %s BTF", | 1268 | ImGui::Text("Not phrase-backed immature mining rewards: %s BTF", |
| 1265 | FmtMoney(g_recoveryAudit.nLegacyImmatureCredit).c_str()); | 1269 | FmtMoney(g_recoveryAudit.nLegacyImmatureCredit).c_str()); |
| 1266 | if (!g_recoveryAudit.fDeriveComplete) | 1270 | if (!g_recoveryAudit.fDeriveComplete) |
| 1267 | { | 1271 | { |
| @@ -1275,8 +1279,8 @@ static void DrawWalletSafetyDialog() | |||
| 1275 | ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.75f, 0.25f, 1.0f)); | 1279 | ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.75f, 0.25f, 1.0f)); |
| 1276 | ImGui::TextWrapped( | 1280 | ImGui::TextWrapped( |
| 1277 | "Some coins are on keys the phrase does not reproduce. " | 1281 | "Some coins are on keys the phrase does not reproduce. " |
| 1278 | "Keep wallet.dat backups until that balance has been moved to a " | 1282 | "Keep a file backup of this wallet until that balance has been " |
| 1279 | "phrase-backed address."); | 1283 | "moved to a phrase-backed address."); |
| 1280 | ImGui::PopStyleColor(); | 1284 | ImGui::PopStyleColor(); |
| 1281 | } | 1285 | } |
| 1282 | else if (HaveHDSeed() && | 1286 | else if (HaveHDSeed() && |
diff --git a/src/walletcmd.cpp b/src/walletcmd.cpp index 1f1fd27..f59fc0c 100644 --- a/src/walletcmd.cpp +++ b/src/walletcmd.cpp | |||
| @@ -429,13 +429,13 @@ int CmdRecoveryAudit() | |||
| 429 | } | 429 | } |
| 430 | printf(" covered by recovery phrase: %s BTF (%d transaction(s))\n", | 430 | printf(" covered by recovery phrase: %s BTF (%d transaction(s))\n", |
| 431 | FormatMoney(audit.nRecoverableCredit).c_str(), audit.nRecoverableTx); | 431 | FormatMoney(audit.nRecoverableCredit).c_str(), audit.nRecoverableTx); |
| 432 | printf(" wallet.dat-only balance: %s BTF (%d transaction(s))\n", | 432 | printf(" not phrase-backed balance: %s BTF (%d transaction(s))\n", |
| 433 | FormatMoney(audit.nLegacyCredit).c_str(), audit.nLegacyTx); | 433 | FormatMoney(audit.nLegacyCredit).c_str(), audit.nLegacyTx); |
| 434 | printf(" immature mining rewards: %s BTF\n", FormatMoney(nImmatureTotal).c_str()); | 434 | printf(" immature mining rewards: %s BTF\n", FormatMoney(nImmatureTotal).c_str()); |
| 435 | printf(" phrase-backed immature: %s BTF (%d transaction(s))\n", | 435 | printf(" phrase-backed immature: %s BTF (%d transaction(s))\n", |
| 436 | FormatMoney(audit.nRecoverableImmatureCredit).c_str(), | 436 | FormatMoney(audit.nRecoverableImmatureCredit).c_str(), |
| 437 | audit.nRecoverableImmatureTx); | 437 | audit.nRecoverableImmatureTx); |
| 438 | printf(" wallet.dat-only immature: %s BTF (%d transaction(s))\n", | 438 | printf(" not phrase-backed immature: %s BTF (%d transaction(s))\n", |
| 439 | FormatMoney(audit.nLegacyImmatureCredit).c_str(), | 439 | FormatMoney(audit.nLegacyImmatureCredit).c_str(), |
| 440 | audit.nLegacyImmatureTx); | 440 | audit.nLegacyImmatureTx); |
| 441 | 441 | ||
| @@ -457,7 +457,7 @@ int CmdRecoveryAudit() | |||
| 457 | { | 457 | { |
| 458 | printf("\n"); | 458 | printf("\n"); |
| 459 | printf("Warning: some coins are on keys the phrase does not reproduce.\n"); | 459 | printf("Warning: some coins are on keys the phrase does not reproduce.\n"); |
| 460 | printf("Keep wallet.dat backups until that balance has been moved to a phrase-backed address.\n"); | 460 | printf("Keep a file backup of this wallet until that balance has been moved to a phrase-backed address.\n"); |
| 461 | fflush(stdout); | 461 | fflush(stdout); |
| 462 | return 2; | 462 | return 2; |
| 463 | } | 463 | } |