Mercurial > hg > bitcoin
changeset 2853:e69169084410 draft
Check minversion before loading the rest of the wallet
When a 0.6 wallet with compressed pubkeys is created, it writes a
minversion record to prevent older clients from reading it. If the 0.5
loading it sees a key record before seeing the minversion record however,
it will fail with DB_CORRUPT instead of DB_TOO_NEW.
author | Pieter Wuille <pieter.wuille@gmail.com> |
---|---|
date | Thu, 22 Mar 2012 04:59:59 +0100 |
parents | c240e997ac02 |
children | 90cea2c85289 b4b026098ee8 |
files | src/db.cpp |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/db.cpp +++ b/src/db.cpp @@ -795,6 +795,13 @@ //// 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 > VERSION) + return DB_TOO_NEW; + } + // Get cursor Dbc* pcursor = GetCursor(); if (!pcursor) @@ -980,13 +987,6 @@ 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(); }