message: [Wallet] report optional HDKeypath/HDMasterKeyId in validateaddress
diff: @@ -185,6 +185,8 @@ UniValue validateaddress(const UniValue &params, bool fHelp)
  " \"iscompressed\" : true|false, (boolean) If the address is compressed\n"
  " \"account\" : \"account\" (string) DEPRECATED. The account associated with the address, \"\" is "
  "the default account\n"
  + " \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath if the key is HD and available\n"
  + " \"hdmasterkeyid\" : \"<hash160>\" (string, optional) The Hash160 of the HD master pubkey\n"
  "}\n"
  "\nExamples:\n" +
  HelpExampleCli("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"") +
  @@ -217,6 +219,17 @@ UniValue validateaddress(const UniValue &params, bool fHelp)
  ret.pushKVs(detail);
  if (pwalletMain && pwalletMain->mapAddressBook.count(dest))
  ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest].name));
  + const CKeyID *keyID = boost::get<CKeyID>(&dest);
  + if (!keyID)
  + {
  + throw std::runtime_error(strprintf("%s does not refer to a key", params[0].get_str()));
  + }
  + if (pwalletMain && pwalletMain->mapKeyMetadata.count(*keyID) &&
  + !pwalletMain->mapKeyMetadata[*keyID].hdKeypath.empty())
  + {
  + ret.push_back(Pair("hdkeypath", pwalletMain->mapKeyMetadata[*keyID].hdKeypath));
  + ret.push_back(Pair("hdmasterkeyid", pwalletMain->mapKeyMetadata[*keyID].hdMasterKeyID.GetHex()));
  + }
  #endif
  }
  return ret;
  