Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115537
D6404.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D6404.diff
View Options
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<CTxDestination, int64_t> mapKeyBirth;
+ std::map<CKeyID, int64_t> mapKeyBirth;
const std::map<CKeyID, int64_t> &mapKeyPool = pwallet->GetAllReserveKeys();
pwallet->GetKeyBirthTimes(*locked_chain, mapKeyBirth);
std::set<CScriptID> scripts = pwallet->GetCScripts();
- // TODO: include scripts in GetKeyBirthTimes() output instead of separate
// sort time/key pairs
std::vector<std::pair<int64_t, CKeyID>> vKeyBirth;
for (const auto &entry : mapKeyBirth) {
- if (const PKHash *keyID = boost::get<PKHash>(&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<CTxDestination, int64_t> &mapKeyBirth) const
+ std::map<CKeyID, int64_t> &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<CTxDestination, int64_t> &mapKeyBirth) const {
+void CWallet::GetKeyBirthTimes(interfaces::Chain::Lock &locked_chain,
+ std::map<CKeyID, int64_t> &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<CKeyID, int> 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;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 11:20 (5 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187573
Default Alt Text
D6404.diff (3 KB)
Attached To
D6404: [backport#15452] GetKeyBirthTimes should return key ids, not destinations
Event Timeline
Log In to Comment