GetKeyBirthTimes should return key ids, not destinations

This commit is contained in:
Gregory Sanders
2019-04-29 10:14:47 -04:00
parent 70946e7fee
commit 78e407ad0c
3 changed files with 7 additions and 10 deletions

View File

@@ -807,19 +807,16 @@ UniValue dumpwallet(const JSONRPCRequest& request)
if (!file.is_open())
throw JSONRPCError(RPC_INVALID_PARAMETER, "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());