diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2016-11-08 16:28:20 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2017-02-10 15:49:00 -0500 |
commit | a58370e6a2d4dce50eefbcab5bde9f14facef8fc (patch) | |
tree | b5c4fd59bba41e4383f1536d908f0fcedbe176f8 /src/wallet/walletdb.cpp | |
parent | 266a8114cbe2a87a6c84d7690a7716a18d782c56 (diff) |
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.
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r-- | src/wallet/walletdb.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index b00ce36b70..15e1e4c45f 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -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]); |