Update copyrights to 2012 for files modified this year
[novacoin.git] / src / db.cpp
index bd31bd7..783b079 100644 (file)
@@ -1,5 +1,5 @@
 // Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2011 The Bitcoin developers
+// Copyright (c) 2009-2012 The Bitcoin developers
 // Distributed under the MIT/X11 software license, see the accompanying
 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
 
@@ -879,7 +879,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
                     CPrivKey pkey;
                     ssValue >> pkey;
                     key.SetPrivKey(pkey);
-                    if (key.GetPubKey() != vchPubKey)
+                    if (key.GetPubKey() != vchPubKey || !key.IsValid())
                         return DB_CORRUPT;
                 }
                 else
@@ -887,6 +887,8 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
                     CWalletKey wkey;
                     ssValue >> wkey;
                     key.SetPrivKey(wkey.vchPrivKey);
+                    if (key.GetPubKey() != vchPubKey || !key.IsValid())
+                        return DB_CORRUPT;
                 }
                 if (!pwallet->LoadKey(key))
                     return DB_CORRUPT;