upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db.cpp16
-rw-r--r--src/main_gui.cpp15
2 files changed, 31 insertions, 0 deletions
diff --git a/src/db.cpp b/src/db.cpp
index c4ea81e..771a4ba 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -1496,6 +1496,22 @@ bool LoadWalletFromSQLiteRuntime(const string& strPath)
1496 return false; 1496 return false;
1497 } 1497 }
1498 1498
1499 // Refuse an empty or non-wallet SQLite file up front, with a message that
1500 // names the likely cause. FinishLoadedWallet below already rejects a
1501 // missing default key (it is the fMayCreateDefaultKey=false path), but its
1502 // wording -- "no usable default public key" -- reads as corruption when the
1503 // real story is usually "this file was never an exported wallet". A blank
1504 // wallet.sqlite left by a typo or a half-run export should say so.
1505 if (visitor.vchDefaultKey.empty())
1506 {
1507 WalletSQLiteRuntimeClose();
1508 strWalletLoadError =
1509 "SQLite wallet has no default key record; it may be empty or not a "
1510 "wallet export. Create it with -walletsqliteexport.";
1511 printf("LoadWallet: %s\n", strWalletLoadError.c_str());
1512 return false;
1513 }
1514
1499 if (!ReconcileLoadedWalletMetadata(visitor.fHaveStoredMineMode, 1515 if (!ReconcileLoadedWalletMetadata(visitor.fHaveStoredMineMode,
1500 visitor.fHaveStoredHDCoinType)) 1516 visitor.fHaveStoredHDCoinType))
1501 { 1517 {
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