diff options
| author | bitflash <admin@bitflash.network> | 2026-08-18 10:16:59 -0300 |
|---|---|---|
| committer | bitflash <admin@bitflash.network> | 2026-08-18 10:16:59 -0300 |
| commit | 00c7aaed74e57da18598faa6751b7720598de3bd (patch) | |
| tree | 914f2851ce35919230c51ca083d3a964d6722408 /src/main_gui.cpp | |
| parent | 2a2b9d74f8fb6b5d86d750e6e5d18c942738f95c (diff) | |
wallet: clearer refusal for an empty or misnamed SQLite backend
Review follow-up on the SQLite activation. Two guards, both fail-closed;
neither is a correctness fix -- FinishLoadedWallet already refuses a
missing default key -- but they make the refusal say what happened:
- an empty or non-wallet wallet.sqlite is refused with "no default key
record; it may be empty or not a wallet export", instead of the generic
"no usable default public key" that reads as corruption;
- a misspelled -walletbackend value (e.g. sqlit) is refused instead of
silently falling through to Berkeley DB; -walletbackend=bdb is accepted
as the explicit default.
Diffstat (limited to 'src/main_gui.cpp')
| -rw-r--r-- | src/main_gui.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 4d77533..4be4995 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp | |||
| @@ -625,6 +625,21 @@ int main(int argc, char* argv[]) | |||
| 625 | string strWalletSQLite = | 625 | string strWalletSQLite = |
| 626 | argval2(argc, argv, "/walletsqlite", "-walletsqlite"); | 626 | argval2(argc, argv, "/walletsqlite", "-walletsqlite"); |
| 627 | 627 | ||
| 628 | // A misspelled backend must not fall through to Berkeley DB silently -- | ||
| 629 | // someone who typed -walletbackend=sqlit meant to run on SQLite, and | ||
| 630 | // opening wallet.dat instead of telling them is the wrong surprise. | ||
| 631 | if (!strWalletBackend.empty() && | ||
| 632 | strWalletBackend != "sqlite" && strWalletBackend != "bdb") | ||
| 633 | { | ||
| 634 | AttachTerminal(); | ||
| 635 | FatalStartupError(fHeadlessStartup, | ||
| 636 | strprintf("Unknown wallet backend '%s'.", strWalletBackend.c_str()), | ||
| 637 | "Use -walletbackend=sqlite for the experimental SQLite backend, " | ||
| 638 | "or omit -walletbackend (or -walletbackend=bdb) to use the " | ||
| 639 | "default Berkeley DB wallet.dat."); | ||
| 640 | return 1; | ||
| 641 | } | ||
| 642 | |||
| 628 | if (strWalletBackend == "sqlite") | 643 | if (strWalletBackend == "sqlite") |
| 629 | { | 644 | { |
| 630 | // Opt-in, experimental. The node runs on <datadir>/wallet.sqlite and | 645 | // Opt-in, experimental. The node runs on <datadir>/wallet.sqlite and |