diff options
Diffstat (limited to 'src/db.cpp')
| -rw-r--r-- | src/db.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -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 | { |