aboutsummaryrefslogtreecommitdiff
path: root/src/db.cpp
diff options
context:
space:
mode:
authorMatt Corallo <matt@bluematt.me>2011-07-05 03:06:19 +0200
committerMatt Corallo <matt@bluematt.me>2011-07-05 18:36:01 +0200
commit7ec552676c66488fe00fb503d02ec4a389a715b7 (patch)
tree6791d8dd85e2aaa82ee7b2396b123716ccd093f2 /src/db.cpp
parent9390431ce49893cbdf23846edb4bdf72b3d4e830 (diff)
downloadbitcoin-7ec552676c66488fe00fb503d02ec4a389a715b7.tar.xz
Add minversion to wallet.
Diffstat (limited to 'src/db.cpp')
-rw-r--r--src/db.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/db.cpp b/src/db.cpp
index f044355a35..9e13727ae7 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -670,7 +670,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
}
-bool CWalletDB::LoadWallet(CWallet* pwallet)
+int CWalletDB::LoadWallet(CWallet* pwallet)
{
pwallet->vchDefaultKey.clear();
int nFileVersion = 0;
@@ -690,7 +690,7 @@ bool CWalletDB::LoadWallet(CWallet* pwallet)
// Get cursor
Dbc* pcursor = GetCursor();
if (!pcursor)
- return false;
+ return DB_CORRUPT;
loop
{
@@ -701,7 +701,7 @@ bool CWalletDB::LoadWallet(CWallet* pwallet)
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
- return false;
+ return DB_CORRUPT;
// Unserialize
// Taking advantage of the fact that pair serialization
@@ -809,6 +809,13 @@ bool CWalletDB::LoadWallet(CWallet* pwallet)
if (strKey == "addrProxy") ssValue >> addrProxy;
if (fHaveUPnP && strKey == "fUseUPnP") ssValue >> fUseUPnP;
}
+ else if (strType == "minversion")
+ {
+ int nMinVersion = 0;
+ ssValue >> nMinVersion;
+ if (nMinVersion > VERSION)
+ return DB_TOO_NEW;
+ }
}
pcursor->close();
}
@@ -839,7 +846,7 @@ bool CWalletDB::LoadWallet(CWallet* pwallet)
}
- return true;
+ return DB_LOAD_OK;
}
void ThreadFlushWalletDB(void* parg)