mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Pass CTxDestination to ScriptPubKeyMan::GetMetadata
Pass CTxDestination instead of more ambiguous uint160 hash value. This is more
type safe and more efficient since it avoids doing map lookups that will always
fail and were not done previously before
a18edd7b38 from
https://github.com/bitcoin/bitcoin/pull/17304
Change suggested by Andrew Chow <achow101-github@achow101.com> in
https://github.com/bitcoin/bitcoin/pull/17304#discussion_r340345745 and
https://github.com/bitcoin/bitcoin/pull/17381#issuecomment-549994944
This commit is contained in:
@@ -3765,15 +3765,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
|
||||
ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan();
|
||||
if (spk_man) {
|
||||
CKeyID key_id = GetKeyForDestination(*provider, dest);
|
||||
const CKeyMetadata* meta = nullptr;
|
||||
if (!key_id.IsNull()) {
|
||||
meta = spk_man->GetMetadata(key_id);
|
||||
}
|
||||
if (!meta) {
|
||||
meta = spk_man->GetMetadata(CScriptID(scriptPubKey));
|
||||
}
|
||||
if (meta) {
|
||||
if (const CKeyMetadata* meta = spk_man->GetMetadata(dest)) {
|
||||
ret.pushKV("timestamp", meta->nCreateTime);
|
||||
if (meta->has_key_origin) {
|
||||
ret.pushKV("hdkeypath", WriteHDKeypath(meta->key_origin.path));
|
||||
|
||||
Reference in New Issue
Block a user