From 434e4273b96cb9204fea346c3fbc65583b01c55b Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 29 Apr 2013 19:50:40 +0200 Subject: Add GetKeyBirthTimes to wallet Compute safe lower bounds on the birth times of all wallet keys. For pool keys or keys with metadata, the actually stored birth time is used. For all others, the birth times are inferred from the wallet transactions. --- src/walletdb.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/walletdb.cpp') diff --git a/src/walletdb.cpp b/src/walletdb.cpp index bf23357f7..702e219a5 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -365,7 +365,16 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, { int64 nIndex; ssKey >> nIndex; + CKeyPool keypool; + ssValue >> keypool; pwallet->setKeyPool.insert(nIndex); + + // If no metadata exists yet, create a default with the pool key's + // creation time. Note that this may be overwritten by actually + // stored metadata for that key later, which is fine. + CKeyID keyid = keypool.vchPubKey.GetID(); + if (pwallet->mapKeyMetadata.count(keyid) == 0) + pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime); } else if (strType == "version") { -- cgit v1.2.3