Skip to content

Commit

Permalink
follow-up Merge bitcoin#17381: LegacyScriptPubKeyMan code cleanups - …
Browse files Browse the repository at this point in the history
…now it's possible to remove workaround
  • Loading branch information
knst authored and UdjinM6 committed Nov 16, 2023
1 parent ab1f7bb commit 9d13c53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3824,12 +3824,12 @@ UniValue getaddressinfo(const JSONRPCRequest& request)

ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey);
if (spk_man) {
const PKHash *pkhash = std::get_if<PKHash>(&dest);
if (const CKeyMetadata* meta = spk_man->GetMetadata(dest)) {
ret.pushKV("timestamp", meta->nCreateTime);
CHDChain hdChainCurrent;
LegacyScriptPubKeyMan* legacy_spk_man = pwallet->GetLegacyScriptPubKeyMan();
if (legacy_spk_man != nullptr) {
const PKHash *pkhash = std::get_if<PKHash>(&dest);
if (pkhash && legacy_spk_man->HaveHDKey(ToKeyID(*pkhash), hdChainCurrent)) {
ret.pushKV("hdchainid", hdChainCurrent.GetID().GetHex());
}
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,9 @@ const CKeyMetadata* LegacyScriptPubKeyMan::GetMetadata(const CTxDestination& des
{
LOCK(cs_KeyStore);

const PKHash *pkhash = std::get_if<PKHash>(&dest);
if (pkhash != nullptr && !ToKeyID(*pkhash).IsNull()) {
auto it = mapKeyMetadata.find(ToKeyID(*pkhash));
CKeyID key_id = GetKeyForDestination(*this, dest);
if (!key_id.IsNull()) {
auto it = mapKeyMetadata.find(key_id);
if (it != mapKeyMetadata.end()) {
return &it->second;
}
Expand Down

0 comments on commit 9d13c53

Please sign in to comment.