Skip to content

Commit

Permalink
rpc: incorporate review feedback from PR 17283
Browse files Browse the repository at this point in the history
- (reverted after follow-on review by maintainers: provide a valid address in getaddressinfo RPCExample)
- remove unneeded code comments
  • Loading branch information
jonatack committed Dec 28, 2019
1 parent 6cb80a0 commit 7851f14
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3708,6 +3708,8 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
return NullUniValue;
}

const std::string example_address = "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"";

RPCHelpMan{"getaddressinfo",
"\nReturn information about the given bitcoin address.\n"
"Some of the information will only be present if the address is in the active wallet.\n",
Expand Down Expand Up @@ -3758,8 +3760,8 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
"}\n"
},
RPCExamples{
HelpExampleCli("getaddressinfo", "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"") +
HelpExampleRpc("getaddressinfo", "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"")
HelpExampleCli("getaddressinfo", example_address) +
HelpExampleRpc("getaddressinfo", example_address)
},
}.Check(request);

Expand Down Expand Up @@ -3793,10 +3795,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)

ret.pushKV("iswatchonly", bool(mine & ISMINE_WATCH_ONLY));

// Return DescribeWalletAddress fields.
// Always returned: isscript, ischange, iswitness.
// Optional: witness_version, witness_program, script, hex, pubkeys (array),
// sigsrequired, pubkey, embedded, iscompressed.
UniValue detail = DescribeWalletAddress(pwallet, dest);
ret.pushKVs(detail);

Expand All @@ -3809,8 +3807,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)

ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));

// Fetch KeyMetadata, if present, for the timestamp, hdkeypath, hdseedid,
// and hdmasterfingerprint fields.
ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey);
if (spk_man) {
if (const CKeyMetadata* meta = spk_man->GetMetadata(dest)) {
Expand Down

0 comments on commit 7851f14

Please sign in to comment.