mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#16502: Drop unused OldKey
This commit is contained in:
parent
1f61b27399
commit
f2af35c92e
@ -601,24 +601,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Private key that was serialized by an old wallet (only used for deserialization) */
|
|
||||||
struct OldKey {
|
|
||||||
CPrivKey vchPrivKey;
|
|
||||||
|
|
||||||
SERIALIZE_METHODS(CWalletKey, obj)
|
|
||||||
{
|
|
||||||
// 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(obj.vchPrivKey, obj.nTimeCreated, obj.nTimeExpires, LIMITED_STRING(obj.strComment, 65536));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CoinSelectionParams
|
struct CoinSelectionParams
|
||||||
{
|
{
|
||||||
bool use_bnb = true;
|
bool use_bnb = true;
|
||||||
|
@ -120,7 +120,6 @@ bool WalletBatch::WriteCryptedKey(const CPubKey& vchPubKey,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
EraseIC(std::make_pair(DBKeys::KEY, vchPubKey));
|
EraseIC(std::make_pair(DBKeys::KEY, vchPubKey));
|
||||||
EraseIC(std::make_pair(DBKeys::OLD_KEY, vchPubKey));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +278,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||||||
ssValue >> fYes;
|
ssValue >> fYes;
|
||||||
if (fYes == '1')
|
if (fYes == '1')
|
||||||
pwallet->LoadWatchOnly(script);
|
pwallet->LoadWatchOnly(script);
|
||||||
} else if (strType == DBKeys::KEY || strType == DBKeys::OLD_KEY) {
|
} else if (strType == DBKeys::KEY) {
|
||||||
CPubKey vchPubKey;
|
CPubKey vchPubKey;
|
||||||
ssKey >> vchPubKey;
|
ssKey >> vchPubKey;
|
||||||
if (!vchPubKey.IsValid())
|
if (!vchPubKey.IsValid())
|
||||||
@ -291,14 +290,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||||||
CPrivKey pkey;
|
CPrivKey pkey;
|
||||||
uint256 hash;
|
uint256 hash;
|
||||||
|
|
||||||
if (strType == DBKeys::KEY) {
|
wss.nKeys++;
|
||||||
wss.nKeys++;
|
ssValue >> pkey;
|
||||||
ssValue >> pkey;
|
|
||||||
} else {
|
|
||||||
OldKey wkey;
|
|
||||||
ssValue >> wkey;
|
|
||||||
pkey = wkey.vchPrivKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Old wallets store keys as DBKeys::KEY [pubkey] => [privkey]
|
// Old wallets store keys as DBKeys::KEY [pubkey] => [privkey]
|
||||||
// ... which was slow for wallets with lots of keys, because the public key is re-derived from the private key
|
// ... which was slow for wallets with lots of keys, because the public key is re-derived from the private key
|
||||||
@ -474,6 +467,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||||||
strErr = "Error reading wallet database: Unknown non-tolerable wallet flags found";
|
strErr = "Error reading wallet database: Unknown non-tolerable wallet flags found";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (strType == DBKeys::OLD_KEY) {
|
||||||
|
strErr = "Found unsupported 'wkey' record, try loading with version 0.17";
|
||||||
|
return false;
|
||||||
} else if (strType != DBKeys::BESTBLOCK && strType != DBKeys::BESTBLOCK_NOMERKLE &&
|
} else if (strType != DBKeys::BESTBLOCK && strType != DBKeys::BESTBLOCK_NOMERKLE &&
|
||||||
strType != DBKeys::MINVERSION && strType != DBKeys::ACENTRY && strType != DBKeys::VERSION) {
|
strType != DBKeys::MINVERSION && strType != DBKeys::ACENTRY && strType != DBKeys::VERSION) {
|
||||||
wss.m_unknown_records++;
|
wss.m_unknown_records++;
|
||||||
@ -494,7 +490,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||||||
|
|
||||||
bool WalletBatch::IsKeyType(const std::string& strType)
|
bool WalletBatch::IsKeyType(const std::string& strType)
|
||||||
{
|
{
|
||||||
return (strType == DBKeys::KEY || strType == DBKeys::OLD_KEY ||
|
return (strType == DBKeys::KEY ||
|
||||||
strType == DBKeys::MASTER_KEY || strType == DBKeys::CRYPTED_KEY ||
|
strType == DBKeys::MASTER_KEY || strType == DBKeys::CRYPTED_KEY ||
|
||||||
strType == DBKeys::HDCHAIN || strType == DBKeys::CRYPTED_HDCHAIN);
|
strType == DBKeys::HDCHAIN || strType == DBKeys::CRYPTED_HDCHAIN);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user