@@ -115,7 +115,6 @@ bool WalletBatch::WriteCryptedKey(const CPubKey& vchPubKey,
115
115
return false ;
116
116
}
117
117
EraseIC (std::make_pair (DBKeys::KEY, vchPubKey));
118
- EraseIC (std::make_pair (DBKeys::OLD_KEY, vchPubKey));
119
118
return true ;
120
119
}
121
120
@@ -256,7 +255,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
256
255
ssValue >> fYes ;
257
256
if (fYes == ' 1' )
258
257
pwallet->LoadWatchOnly (script);
259
- } else if (strType == DBKeys::KEY || strType == DBKeys::OLD_KEY ) {
258
+ } else if (strType == DBKeys::KEY) {
260
259
CPubKey vchPubKey;
261
260
ssKey >> vchPubKey;
262
261
if (!vchPubKey.IsValid ())
@@ -268,14 +267,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
268
267
CPrivKey pkey;
269
268
uint256 hash;
270
269
271
- if (strType == DBKeys::KEY) {
272
- wss.nKeys ++;
273
- ssValue >> pkey;
274
- } else {
275
- OldKey wkey;
276
- ssValue >> wkey;
277
- pkey = wkey.vchPrivKey ;
278
- }
270
+ wss.nKeys ++;
271
+ ssValue >> pkey;
279
272
280
273
// Old wallets store keys as DBKeys::KEY [pubkey] => [privkey]
281
274
// ... which was slow for wallets with lots of keys, because the public key is re-derived from the private key
@@ -407,6 +400,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
407
400
strErr = " Error reading wallet database: Unknown non-tolerable wallet flags found" ;
408
401
return false ;
409
402
}
403
+ } else if (strType == DBKeys::OLD_KEY) {
404
+ strErr = " Found unsupported 'wkey' record, try loading with version 0.18" ;
405
+ return false ;
410
406
} else if (strType != DBKeys::BESTBLOCK && strType != DBKeys::BESTBLOCK_NOMERKLE &&
411
407
strType != DBKeys::MINVERSION && strType != DBKeys::ACENTRY &&
412
408
strType != DBKeys::VERSION && strType != DBKeys::SETTINGS) {
@@ -428,7 +424,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
428
424
429
425
bool WalletBatch::IsKeyType (const std::string& strType)
430
426
{
431
- return (strType == DBKeys::KEY || strType == DBKeys::OLD_KEY ||
427
+ return (strType == DBKeys::KEY ||
432
428
strType == DBKeys::MASTER_KEY || strType == DBKeys::CRYPTED_KEY);
433
429
}
434
430
0 commit comments