upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/db.cpp
diff options
context:
space:
mode:
authorbitflash <admin@bitflash.network>2026-08-18 10:16:59 -0300
committerbitflash <admin@bitflash.network>2026-08-18 10:16:59 -0300
commit00c7aaed74e57da18598faa6751b7720598de3bd (patch)
tree914f2851ce35919230c51ca083d3a964d6722408 /src/db.cpp
parent2a2b9d74f8fb6b5d86d750e6e5d18c942738f95c (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/db.cpp')
-rw-r--r--src/db.cpp16
1 files changed, 16 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 {