diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -708,31 +708,6 @@ } }; -/** - * Private key that was serialized by an old wallet (only used for - * deserialization) */ -struct OldKey { - CPrivKey vchPrivKey; - ADD_SERIALIZE_METHODS; - - template - inline void SerializationOp(Stream &s, Operation ser_action) { - // no longer used by the wallet, thus dropped after deserialization: - int64_t nTimeCreated; - int64_t nTimeExpires; - std::string strComment; - - int nVersion = s.GetVersion(); - if (!(s.GetType() & SER_GETHASH)) { - READWRITE(nVersion); - } - READWRITE(vchPrivKey); - READWRITE(nTimeCreated); - READWRITE(nTimeExpires); - READWRITE(LIMITED_STRING(strComment, 65536)); - } -}; - struct CoinSelectionParams { bool use_bnb = true; size_t change_output_size = 0; diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -132,7 +132,6 @@ return false; } EraseIC(std::make_pair(DBKeys::KEY, vchPubKey)); - EraseIC(std::make_pair(DBKeys::OLD_KEY, vchPubKey)); return true; } @@ -280,7 +279,7 @@ if (fYes == '1') { pwallet->LoadWatchOnly(script); } - } else if (strType == DBKeys::KEY || strType == DBKeys::OLD_KEY) { + } else if (strType == DBKeys::KEY) { CPubKey vchPubKey; ssKey >> vchPubKey; if (!vchPubKey.IsValid()) { @@ -291,14 +290,8 @@ CPrivKey pkey; uint256 hash; - if (strType == DBKeys::KEY) { - wss.nKeys++; - ssValue >> pkey; - } else { - OldKey wkey; - ssValue >> wkey; - pkey = wkey.vchPrivKey; - } + wss.nKeys++; + ssValue >> pkey; // Old wallets store keys as DBKeys::KEY [pubkey] => [privkey] ... // which was slow for wallets with lots of keys, because the public @@ -431,6 +424,10 @@ "wallet flags found"; return false; } + } else if (strType == DBKeys::OLD_KEY) { + strErr = "Found unsupported 'wkey' record, try loading with " + "version 0.20"; + return false; } else if (strType != DBKeys::BESTBLOCK && strType != DBKeys::BESTBLOCK_NOMERKLE && strType != DBKeys::MINVERSION && @@ -445,8 +442,8 @@ } bool WalletBatch::IsKeyType(const std::string &strType) { - return (strType == DBKeys::KEY || strType == DBKeys::OLD_KEY || - strType == DBKeys::MASTER_KEY || strType == DBKeys::CRYPTED_KEY); + return (strType == DBKeys::KEY || strType == DBKeys::MASTER_KEY || + strType == DBKeys::CRYPTED_KEY); } DBErrors WalletBatch::LoadWallet(CWallet *pwallet) {