diff options
| author | bitflash <dev@bitflash.network> | 2026-08-18 16:26:34 -0300 |
|---|---|---|
| committer | bitflash <dev@bitflash.network> | 2026-08-18 16:26:34 -0300 |
| commit | 477d57b9a01102b6f79ad9b10b2dcfd280faa1cb (patch) | |
| tree | c320e5c1f6e486affdf255a1a4ac806a01b9da7c /src/walletcmd.h | |
| parent | 3f94ec0649f935d00de49ad7b55026317dc64a27 (diff) | |
gui: offer to convert a Berkeley DB wallet to SQLite on first run
A first-run dialog for an existing wallet.dat with no backend choice yet:
"Convert to SQLite" exports the wallet and records the sqlite marker so
the next start opens it; "Keep Berkeley DB" records that choice so the
offer does not return; "Decide later" leaves no marker and asks again.
wallet.dat is never touched, and the change takes effect on restart --
matching the restart-to-apply model.
The conversion itself is DoConvertWalletToSQLite(), a headless-testable
function the button calls: it reuses the export path (extracted as
ExportActiveWalletToSQLite, shared with -walletsqliteexport, which keeps
its own specific messages), refuses if already on SQLite or if a
wallet.sqlite exists, and writes the marker only after a verified export.
New wallet-convert self-test proves the action end to end: build a
Berkeley DB wallet, convert, and confirm wallet.sqlite + the marker are
written, wallet.dat is left untouched, a second convert refuses, and a
flagless restart opens the converted SQLite wallet with its phrase intact.
All wallet suites pass. The modal itself is thin UI over this tested
action.
Diffstat (limited to 'src/walletcmd.h')
| -rw-r--r-- | src/walletcmd.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/walletcmd.h b/src/walletcmd.h index d993856..38cbfdb 100644 --- a/src/walletcmd.h +++ b/src/walletcmd.h | |||
| @@ -75,6 +75,15 @@ int CmdWalletStorageCheck(); | |||
| 75 | // not change which backend the runtime wallet opens. | 75 | // not change which backend the runtime wallet opens. |
| 76 | int CmdWalletSQLiteExport(const std::string& strDest); | 76 | int CmdWalletSQLiteExport(const std::string& strDest); |
| 77 | 77 | ||
| 78 | // Export the currently-loaded wallet to a SQLite file (shared by the command | ||
| 79 | // above and the GUI wizard). Returns false with an error on any failure. | ||
| 80 | bool ExportActiveWalletToSQLite(const std::string& strDest, int& nCopiedRet, | ||
| 81 | std::string& strErrorRet); | ||
| 82 | |||
| 83 | // Convert the running Berkeley DB wallet to SQLite and record the backend | ||
| 84 | // marker so the next start opens it. wallet.dat is left untouched as fallback. | ||
| 85 | bool DoConvertWalletToSQLite(int& nCopiedRet, std::string& strErrorRet); | ||
| 86 | |||
| 78 | // Diagnostic/migration staging: compare a SQLite wallet export with the current | 87 | // Diagnostic/migration staging: compare a SQLite wallet export with the current |
| 79 | // wallet.dat raw records. Prints counts only, never record keys or values. | 88 | // wallet.dat raw records. Prints counts only, never record keys or values. |
| 80 | int CmdWalletSQLiteVerify(const std::string& strPath); | 89 | int CmdWalletSQLiteVerify(const std::string& strPath); |