RPC getaddressinfo should use CWallet::GetKeyOrigin #14682

issue Sjors opened this issue on November 7, 2018
  1. Sjors commented at 4:48 PM on November 7, 2018: member

    Currently the getaddressinfo RPC call accesses the wallet metadata directly:

            if (!meta->hdKeypath.empty()) {
                ret.pushKV("hdkeypath", meta->hdKeypath);
                ret.pushKV("hdseedid", meta->hd_seed_id.GetHex());
                if (!meta->master_key_id.IsNull()) {
                    ret.pushKV("hdmasterkeyid", meta->master_key_id.GetHex());
                }
            }
    

    CWallet::GetKeyOrigin was introduced in https://github.com/bitcoin/bitcoin/pull/13723/commits/03a99586a398ee38f40c3b72d24c6a2ba4b88579

    Probably not urgent, but I noticed this issue while debugging a problem on an experimental branch where getaddressinfo showed the origin info just fine but GetKeyOrigin failed.

  2. fanquake added the label Refactoring on Nov 9, 2018
  3. fanquake added the label RPC/REST/ZMQ on Nov 9, 2018
  4. Sjors commented at 2:26 PM on February 19, 2019: member

    It's been changed a bit, but still relies on unencapsulated access to pwallet->mapKeyMetadata:

            if (meta->has_key_origin) {
                ret.pushKV("hdkeypath", WriteHDKeypath(meta->key_origin.path));
                ret.pushKV("hdseedid", meta->hd_seed_id.GetHex());
                ret.pushKV("hdmasterfingerprint", HexStr(meta->key_origin.fingerprint, meta->key_origin.fingerprint + 4));
            }
    

    A good time to fix this is while adding origin info the GUI, which is probably useful for hardware wallet address verification, since devices often echo the derivation path (#14145).

  5. Sjors commented at 12:53 PM on September 6, 2022: member

    It now uses spk_man->GetMetadata().

  6. Sjors closed this on Sep 6, 2022

  7. bitcoin locked this on Sep 6, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me