0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

rpc: incorporate review feedback from PR 17283

- (reverted after follow-on review by maintainers: provide a valid address in getaddressinfo RPCExample)
- remove unneeded code comments
This commit is contained in:
Jon Atack 2019-11-26 17:11:52 +01:00
parent 6cb80a068d
commit 7851f14ccf
No known key found for this signature in database
GPG key ID: 4F5721B3D0E3921D

View file

@ -3708,6 +3708,8 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
return NullUniValue; return NullUniValue;
} }
const std::string example_address = "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"";
RPCHelpMan{"getaddressinfo", RPCHelpMan{"getaddressinfo",
"\nReturn information about the given bitcoin address.\n" "\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", "Some of the information will only be present if the address is in the active wallet.\n",
@ -3758,8 +3760,8 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
"}\n" "}\n"
}, },
RPCExamples{ RPCExamples{
HelpExampleCli("getaddressinfo", "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"") + HelpExampleCli("getaddressinfo", example_address) +
HelpExampleRpc("getaddressinfo", "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"") HelpExampleRpc("getaddressinfo", example_address)
}, },
}.Check(request); }.Check(request);
@ -3793,10 +3795,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
ret.pushKV("iswatchonly", bool(mine & ISMINE_WATCH_ONLY)); 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); UniValue detail = DescribeWalletAddress(pwallet, dest);
ret.pushKVs(detail); ret.pushKVs(detail);
@ -3809,8 +3807,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
ret.pushKV("ischange", pwallet->IsChange(scriptPubKey)); ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));
// Fetch KeyMetadata, if present, for the timestamp, hdkeypath, hdseedid,
// and hdmasterfingerprint fields.
ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey); ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey);
if (spk_man) { if (spk_man) {
if (const CKeyMetadata* meta = spk_man->GetMetadata(dest)) { if (const CKeyMetadata* meta = spk_man->GetMetadata(dest)) {