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:
Diffstat (limited to 'src/db.cpp')
-rw-r--r--src/db.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 9334249..c8642e9 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -48,6 +48,10 @@ private:
48 48
49static CCriticalSection cs_db; 49static CCriticalSection cs_db;
50static bool fDbEnvInit = false; 50static 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.
54string strWalletLoadError;
51DbEnv dbenv(0u); 55DbEnv dbenv(0u);
52static map<string, int> mapFileUseCount; 56static 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 }