Skip to content

Commit

Permalink
Merge pull request #975 from sipa/versioncheck
Browse files Browse the repository at this point in the history
Check minversion before loading the rest of the wallet
  • Loading branch information
gavinandresen committed Mar 22, 2012
2 parents a6b4a11 + ef12c21 commit e12d131
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,14 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
//// todo: shouldn't we catch exceptions and try to recover and continue?
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
Dbc* pcursor = GetCursor();
if (!pcursor)
Expand Down Expand Up @@ -968,14 +976,6 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
if (nFileVersion == 10300)
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")
{
uint160 hash;
Expand Down

0 comments on commit e12d131

Please sign in to comment.