aboutsummaryrefslogtreecommitdiff
path: root/src/walletdb.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-04-29 19:50:40 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2013-06-22 17:30:56 +0200
commit434e4273b96cb9204fea346c3fbc65583b01c55b (patch)
treed9be012ebad51d9adcc439d4d77e73fdf0f43b0f /src/walletdb.cpp
parentacc775c5547a94fa5ad12ecb0bdaeefdc285d853 (diff)
downloadbitcoin-434e4273b96cb9204fea346c3fbc65583b01c55b.tar.xz
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.
Diffstat (limited to 'src/walletdb.cpp')
-rw-r--r--src/walletdb.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/walletdb.cpp b/src/walletdb.cpp
index bf23357f79..702e219a5b 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")
{