Merge pull request #975 from sipa/versioncheck

Check minversion before loading the rest of the wallet
This commit is contained in:
Gavin Andresen 2012-03-22 09:18:11 -07:00
commit e12d131734

View file

@ -799,6 +799,14 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
//// todo: shouldn't we catch exceptions and try to recover and continue? //// todo: shouldn't we catch exceptions and try to recover and continue?
CRITICAL_BLOCK(pwallet->cs_wallet) CRITICAL_BLOCK(pwallet->cs_wallet)
{ {
int nMinVersion = 0;
if (Read((string)"minversion", nMinVersion))
{
if (nMinVersion > CLIENT_VERSION)
return DB_TOO_NEW;
pwallet->LoadMinVersion(nMinVersion);
}
// Get cursor // Get cursor
Dbc* pcursor = GetCursor(); Dbc* pcursor = GetCursor();
if (!pcursor) if (!pcursor)
@ -968,14 +976,6 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
if (nFileVersion == 10300) if (nFileVersion == 10300)
nFileVersion = 300; nFileVersion = 300;
} }
else if (strType == "minversion")
{
int nMinVersion = 0;
ssValue >> nMinVersion;
if (nMinVersion > CLIENT_VERSION)
return DB_TOO_NEW;
pwallet->LoadMinVersion(nMinVersion);
}
else if (strType == "cscript") else if (strType == "cscript")
{ {
uint160 hash; uint160 hash;