diff options
Diffstat (limited to 'src/db.cpp')
| -rw-r--r-- | src/db.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
| @@ -48,6 +48,10 @@ private: | |||
| 48 | 48 | ||
| 49 | static CCriticalSection cs_db; | 49 | static CCriticalSection cs_db; |
| 50 | static bool fDbEnvInit = false; | 50 | static bool fDbEnvInit = false; |
| 51 | |||
| 52 | // Why LoadWallet() refused, in words meant for the person who has to act on it. | ||
| 53 | // Empty unless the reason is one we can name. | ||
| 54 | string strWalletLoadError; | ||
| 51 | DbEnv dbenv(0u); | 55 | DbEnv dbenv(0u); |
| 52 | static map<string, int> mapFileUseCount; | 56 | static map<string, int> mapFileUseCount; |
| 53 | 57 | ||
| @@ -625,6 +629,7 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet) | |||
| 625 | bool fHaveStoredMineMode = false; | 629 | bool fHaveStoredMineMode = false; |
| 626 | bool fHaveStoredHDCoinType = false; | 630 | bool fHaveStoredHDCoinType = false; |
| 627 | vchDefaultKeyRet.clear(); | 631 | vchDefaultKeyRet.clear(); |
| 632 | strWalletLoadError.clear(); | ||
| 628 | 633 | ||
| 629 | // Satoshi's "todo: shouldn't we catch exceptions" sat here since 2009, and | 634 | // Satoshi's "todo: shouldn't we catch exceptions" sat here since 2009, and |
| 630 | // it was not a nicety. Nothing on this path caught anything, so a record | 635 | // it was not a nicety. Nothing on this path caught anything, so a record |
| @@ -779,11 +784,15 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet) | |||
| 779 | ssValue >> nMinVersion; | 784 | ssValue >> nMinVersion; |
| 780 | if (nMinVersion > WALLET_FORMAT_SUPPORTED) | 785 | if (nMinVersion > WALLET_FORMAT_SUPPORTED) |
| 781 | { | 786 | { |
| 782 | printf("LoadWallet: wallet.dat requires wallet format %d, " | 787 | // Said out loud, not only into debug.log: this is the one |
| 783 | "but this build only supports format %d\n", | 788 | // refusal whose whole purpose is to be understood, and the |
| 784 | nMinVersion, WALLET_FORMAT_SUPPORTED); | 789 | // caller puts it in front of the user. |
| 785 | printf("LoadWallet: the file was left untouched. Upgrade " | 790 | strWalletLoadError = strprintf( |
| 786 | "Bitflash before opening this wallet.\n"); | 791 | "This wallet.dat was written by a newer version of Bitflash " |
| 792 | "(wallet format %d; this build understands %d). Upgrade " | ||
| 793 | "Bitflash before opening it.", | ||
| 794 | nMinVersion, WALLET_FORMAT_SUPPORTED); | ||
| 795 | printf("LoadWallet: %s\n", strWalletLoadError.c_str()); | ||
| 787 | return false; | 796 | return false; |
| 788 | } | 797 | } |
| 789 | } | 798 | } |