diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -963,20 +963,16 @@ "Cannot open wallet dump file"); } - std::map mapKeyBirth; + std::map mapKeyBirth; const std::map &mapKeyPool = pwallet->GetAllReserveKeys(); pwallet->GetKeyBirthTimes(*locked_chain, mapKeyBirth); std::set scripts = pwallet->GetCScripts(); - // TODO: include scripts in GetKeyBirthTimes() output instead of separate // sort time/key pairs std::vector> vKeyBirth; for (const auto &entry : mapKeyBirth) { - if (const PKHash *keyID = boost::get(&entry.first)) { - // set and test - vKeyBirth.push_back(std::make_pair(entry.second, CKeyID(*keyID))); - } + vKeyBirth.push_back(std::make_pair(entry.second, entry.first)); } mapKeyBirth.clear(); std::sort(vKeyBirth.begin(), vKeyBirth.end()); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1159,7 +1159,7 @@ bool EncryptWallet(const SecureString &strWalletPassphrase); void GetKeyBirthTimes(interfaces::Chain::Lock &locked_chain, - std::map &mapKeyBirth) const + std::map &mapKeyBirth) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); unsigned int ComputeTimeSmart(const CWalletTx &wtx) const; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4237,9 +4237,8 @@ /** @} */ // end of Actions -void CWallet::GetKeyBirthTimes( - interfaces::Chain::Lock &locked_chain, - std::map &mapKeyBirth) const { +void CWallet::GetKeyBirthTimes(interfaces::Chain::Lock &locked_chain, + std::map &mapKeyBirth) const { // mapKeyMetadata AssertLockHeld(cs_wallet); mapKeyBirth.clear(); @@ -4247,7 +4246,7 @@ // Get birth times for keys with metadata. for (const auto &entry : mapKeyMetadata) { if (entry.second.nCreateTime) { - mapKeyBirth[PKHash(entry.first)] = entry.second.nCreateTime; + mapKeyBirth[entry.first] = entry.second.nCreateTime; } } @@ -4258,7 +4257,7 @@ tip_height && *tip_height > 144 ? *tip_height - 144 : 0; std::map mapKeyFirstBlock; for (const CKeyID &keyid : GetKeys()) { - if (mapKeyBirth.count(PKHash(keyid)) == 0) { + if (mapKeyBirth.count(keyid) == 0) { mapKeyFirstBlock[keyid] = max_height; } } @@ -4293,7 +4292,7 @@ // Extract block timestamps for those keys. for (const auto &entry : mapKeyFirstBlock) { // block times can be 2h off - mapKeyBirth[PKHash(entry.first)] = + mapKeyBirth[entry.first] = locked_chain.getBlockTime(entry.second) - TIMESTAMP_WINDOW; } }