Skip to content

Commit 0c1bd66

Browse files
MarcoFalkeknst
authored andcommitted
Merge bitcoin#23652: doc: Document optional RPC result fields
fab6c43 doc: Document optional result fields in validateaddress (MarcoFalke) faee265 doc: Document optional result fields in getpeerinfo (MarcoFalke) Pull request description: ACKs for top commit: shaavan: ACK fab6c43 Tree-SHA512: 78458d0c4deb9253fbfe37fa5736a7db14eb0478bcc4adeba10ba6945e83d8eac92048293f50c054ea612609939151b4a2e1226c06f6067901f3d58c127c7e18
1 parent 9c5fd3f commit 0c1bd66

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

src/rpc/misc.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -234,25 +234,26 @@ static RPCHelpMan sporkupdate()
234234

235235
static RPCHelpMan validateaddress()
236236
{
237-
return RPCHelpMan{"validateaddress",
238-
"\nReturn information about the given Dash address.\n",
239-
{
240-
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address to validate"},
241-
},
242-
RPCResult{
243-
RPCResult::Type::OBJ, "", "",
244-
{
245-
{RPCResult::Type::BOOL, "isvalid", "If the address is valid or not"},
246-
{RPCResult::Type::STR, "address", /* optional */ true, "The Dash address validated"},
247-
{RPCResult::Type::STR_HEX, "scriptPubKey", /* optional */ true, "The hex-encoded scriptPubKey generated by the address"},
248-
{RPCResult::Type::BOOL, "isscript", /* optional */ true, "If the key is a script"},
249-
{RPCResult::Type::STR, "error", /* optional */ true, "Error message, if any"},
250-
}
251-
},
252-
RPCExamples{
253-
HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") +
254-
HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"")
255-
},
237+
return RPCHelpMan{
238+
"validateaddress",
239+
"\nReturn information about the given Dash address.\n",
240+
{
241+
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address to validate"},
242+
},
243+
RPCResult{
244+
RPCResult::Type::OBJ, "", "",
245+
{
246+
{RPCResult::Type::BOOL, "isvalid", "If the address is valid or not"},
247+
{RPCResult::Type::STR, "address", /* optional */ true, "The Dash address validated"},
248+
{RPCResult::Type::STR_HEX, "scriptPubKey", /* optional */ true, "The hex-encoded scriptPubKey generated by the address"},
249+
{RPCResult::Type::BOOL, "isscript", /* optional */ true, "If the key is a script"},
250+
{RPCResult::Type::STR, "error", /* optional */ true, "Error message, if any"},
251+
}
252+
},
253+
RPCExamples{
254+
HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") +
255+
HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"")
256+
},
256257
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
257258
{
258259
std::string error_msg;

src/rpc/net.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ static RPCHelpMan ping()
9595

9696
static RPCHelpMan getpeerinfo()
9797
{
98-
return RPCHelpMan{"getpeerinfo",
98+
return RPCHelpMan{
99+
"getpeerinfo",
99100
"\nReturns data about each connected network node as a json array of objects.\n",
100101
{},
101102
RPCResult{
@@ -140,16 +141,16 @@ static RPCHelpMan getpeerinfo()
140141
{RPCResult::Type::BOOL, "bip152_hb_from", "Whether peer selected us as (compact blocks) high-bandwidth peer"},
141142
{RPCResult::Type::BOOL, "masternode", "Whether connection was due to masternode connection attempt"},
142143
{RPCResult::Type::NUM, "banscore", "The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)"},
143-
{RPCResult::Type::NUM, "startingheight", "The starting height (block) of the peer"},
144-
{RPCResult::Type::NUM, "synced_headers", "The last header we have in common with this peer"},
145-
{RPCResult::Type::NUM, "synced_blocks", "The last block we have in common with this peer"},
146-
{RPCResult::Type::ARR, "inflight", "",
144+
{RPCResult::Type::NUM, "startingheight", /*optional=*/true, "The starting height (block) of the peer"},
145+
{RPCResult::Type::NUM, "synced_headers", /*optional=*/true, "The last header we have in common with this peer"},
146+
{RPCResult::Type::NUM, "synced_blocks", /*optional=*/true, "The last block we have in common with this peer"},
147+
{RPCResult::Type::ARR, "inflight", /*optional=*/true, "",
147148
{
148149
{RPCResult::Type::NUM, "n", "The heights of blocks we're currently asking from this peer"},
149150
}},
150-
{RPCResult::Type::BOOL, "addr_relay_enabled", "Whether we participate in address relay with this peer"},
151-
{RPCResult::Type::NUM, "addr_processed", "The total number of addresses processed, excluding those dropped due to rate limiting"},
152-
{RPCResult::Type::NUM, "addr_rate_limited", "The total number of addresses dropped due to rate limiting"},
151+
{RPCResult::Type::BOOL, "addr_relay_enabled", /*optional=*/true, "Whether we participate in address relay with this peer"},
152+
{RPCResult::Type::NUM, "addr_processed", /*optional=*/true, "The total number of addresses processed, excluding those dropped due to rate limiting"},
153+
{RPCResult::Type::NUM, "addr_rate_limited", /*optional=*/true, "The total number of addresses dropped due to rate limiting"},
153154
{RPCResult::Type::ARR, "permissions", "Any special permissions that have been granted to this peer",
154155
{
155156
{RPCResult::Type::STR, "permission_type", Join(NET_PERMISSIONS_DOC, ",\n") + ".\n"},
@@ -167,15 +168,16 @@ static RPCHelpMan getpeerinfo()
167168
"Only known message types can appear as keys in the object and all bytes received of unknown message types are listed under '"+NET_MESSAGE_TYPE_OTHER+"'."}
168169
}},
169170
{RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + ".\n"
170-
"Please note this output is unlikely to be stable in upcoming releases as we iterate to\n"
171-
"best capture connection behaviors."},
171+
"Please note this output is unlikely to be stable in upcoming releases as we iterate to\n"
172+
"best capture connection behaviors."},
172173
{RPCResult::Type::STR, "transport_protocol_type", "Type of transport protocol: \n" + Join(TRANSPORT_TYPE_DOC, ",\n") + ".\n"},
173174
{RPCResult::Type::STR, "session_id", "The session ID for this connection, or \"\" if there is none (\"v2\" transport protocol only).\n"},
174175
}},
175-
}}},
176+
}},
177+
},
176178
RPCExamples{
177179
HelpExampleCli("getpeerinfo", "")
178-
+ HelpExampleRpc("getpeerinfo", "")
180+
+ HelpExampleRpc("getpeerinfo", "")
179181
},
180182
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
181183
{

0 commit comments

Comments
 (0)