mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 20:23:35 +01:00
Dedup nTimeFirstKey update logic
Also make nTimeFirstKey member variable private. This is just a cleanup change, it doesn't change behavior in any significant way.
This commit is contained in:
@@ -357,7 +357,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||
|
||||
// Watch-only addresses have no birthday information for now,
|
||||
// so set the wallet birthday to the beginning of time.
|
||||
pwallet->nTimeFirstKey = 1;
|
||||
pwallet->UpdateTimeFirstKey(1);
|
||||
}
|
||||
else if (strType == "key" || strType == "wkey")
|
||||
{
|
||||
@@ -467,11 +467,6 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||
wss.nKeyMeta++;
|
||||
|
||||
pwallet->LoadKeyMetadata(vchPubKey, keyMeta);
|
||||
|
||||
// find earliest key creation time, as wallet birthday
|
||||
if (!pwallet->nTimeFirstKey ||
|
||||
(keyMeta.nCreateTime < pwallet->nTimeFirstKey))
|
||||
pwallet->nTimeFirstKey = keyMeta.nCreateTime;
|
||||
}
|
||||
else if (strType == "defaultkey")
|
||||
{
|
||||
@@ -626,7 +621,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
||||
|
||||
// nTimeFirstKey is only reliable if all keys have metadata
|
||||
if ((wss.nKeys + wss.nCKeys) != wss.nKeyMeta)
|
||||
pwallet->nTimeFirstKey = 1; // 0 would be considered 'no value'
|
||||
pwallet->UpdateTimeFirstKey(1);
|
||||
|
||||
BOOST_FOREACH(uint256 hash, wss.vWalletUpgrade)
|
||||
WriteTx(pwallet->mapWallet[hash]);
|
||||
|
||||
Reference in New Issue
Block a user