From 00c7aaed74e57da18598faa6751b7720598de3bd Mon Sep 17 00:00:00 2001 From: bitflash Date: Tue, 18 Aug 2026 10:16:59 -0300 Subject: 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. --- src/main_gui.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/main_gui.cpp') 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[]) string strWalletSQLite = argval2(argc, argv, "/walletsqlite", "-walletsqlite"); + // A misspelled backend must not fall through to Berkeley DB silently -- + // someone who typed -walletbackend=sqlit meant to run on SQLite, and + // opening wallet.dat instead of telling them is the wrong surprise. + if (!strWalletBackend.empty() && + strWalletBackend != "sqlite" && strWalletBackend != "bdb") + { + AttachTerminal(); + FatalStartupError(fHeadlessStartup, + strprintf("Unknown wallet backend '%s'.", strWalletBackend.c_str()), + "Use -walletbackend=sqlite for the experimental SQLite backend, " + "or omit -walletbackend (or -walletbackend=bdb) to use the " + "default Berkeley DB wallet.dat."); + return 1; + } + if (strWalletBackend == "sqlite") { // Opt-in, experimental. The node runs on /wallet.sqlite and -- cgit v1.2.3