@@ -106,82 +106,83 @@ static RPCHelpMan ping()
106106
107107static RPCHelpMan getpeerinfo ()
108108{
109- return RPCHelpMan{" getpeerinfo" ,
110- " \n Returns data about each connected network node as a json array of objects.\n " ,
111- {},
112- RPCResult{
113- RPCResult::Type::ARR, " " , " " ,
109+ return RPCHelpMan{
110+ " getpeerinfo" ,
111+ " \n Returns data about each connected network node as a json array of objects.\n " ,
112+ {},
113+ RPCResult{
114+ RPCResult::Type::ARR, " " , " " ,
115+ {
116+ {RPCResult::Type::OBJ, " " , " " ,
117+ {
114118 {
115- {RPCResult::Type::OBJ, " " , " " ,
116- {
117- {
118- {RPCResult::Type::NUM, " id" , " Peer index" },
119- {RPCResult::Type::STR, " addr" , " (host:port) The IP address and port of the peer" },
120- {RPCResult::Type::STR, " addrbind" , /* optional */ true , " (ip:port) Bind address of the connection to the peer" },
121- {RPCResult::Type::STR, " addrlocal" , /* optional */ true , " (ip:port) Local address as reported by the peer" },
122- {RPCResult::Type::STR, " network" , " Network (" + Join (GetNetworkNames (/* append_unroutable */ true ), " , " ) + " )" },
123- {RPCResult::Type::NUM, " mapped_as" , /* optional */ true , " The AS in the BGP route to the peer used for diversifying\n "
124- " peer selection (only available if the asmap config flag is set)" },
125- {RPCResult::Type::STR_HEX, " services" , " The services offered" },
126- {RPCResult::Type::ARR, " servicesnames" , " the services offered, in human-readable form" ,
127- {
128- {RPCResult::Type::STR, " SERVICE_NAME" , " the service name if it is recognised" }
129- }},
130- {RPCResult::Type::BOOL, " relaytxes" , " Whether peer has asked us to relay transactions to it" },
131- {RPCResult::Type::NUM_TIME, " lastsend" , " The " + UNIX_EPOCH_TIME + " of the last send" },
132- {RPCResult::Type::NUM_TIME, " lastrecv" , " The " + UNIX_EPOCH_TIME + " of the last receive" },
133- {RPCResult::Type::NUM_TIME, " last_transaction" , " The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer" },
134- {RPCResult::Type::NUM_TIME, " last_block" , " The " + UNIX_EPOCH_TIME + " of the last block received from this peer" },
135- {RPCResult::Type::NUM, " bytessent" , " The total bytes sent" },
136- {RPCResult::Type::NUM, " bytesrecv" , " The total bytes received" },
137- {RPCResult::Type::NUM_TIME, " conntime" , " The " + UNIX_EPOCH_TIME + " of the connection" },
138- {RPCResult::Type::NUM, " timeoffset" , " The time offset in seconds" },
139- {RPCResult::Type::NUM, " pingtime" , /* optional */ true , " ping time (if available)" },
140- {RPCResult::Type::NUM, " minping" , /* optional */ true , " minimum observed ping time (if any at all)" },
141- {RPCResult::Type::NUM, " pingwait" , /* optional */ true , " ping wait (if non-zero)" },
142- {RPCResult::Type::NUM, " version" , " The peer version, such as 70001" },
143- {RPCResult::Type::STR, " subver" , " The string version" },
144- {RPCResult::Type::BOOL, " inbound" , " Inbound (true) or Outbound (false)" },
145- {RPCResult::Type::BOOL, " bip152_hb_to" , " Whether we selected peer as (compact blocks) high-bandwidth peer" },
146- {RPCResult::Type::BOOL, " bip152_hb_from" , " Whether peer selected us as (compact blocks) high-bandwidth peer" },
147- {RPCResult::Type::NUM, " startingheight" , " The starting height (block) of the peer" },
148- {RPCResult::Type::NUM, " synced_headers" , " The last header we have in common with this peer" },
149- {RPCResult::Type::NUM, " synced_blocks" , " The last block we have in common with this peer" },
150- {RPCResult::Type::ARR, " inflight" , " " ,
151- {
152- {RPCResult::Type::NUM, " n" , " The heights of blocks we're currently asking from this peer" },
153- }},
154- {RPCResult::Type::BOOL, " addr_relay_enabled" , " Whether we participate in address relay with this peer" },
155- {RPCResult::Type::NUM, " addr_processed" , " The total number of addresses processed, excluding those dropped due to rate limiting" },
156- {RPCResult::Type::NUM, " addr_rate_limited" , " The total number of addresses dropped due to rate limiting" },
157- {RPCResult::Type::ARR, " permissions" , " Any special permissions that have been granted to this peer" ,
158- {
159- {RPCResult::Type::STR, " permission_type" , Join (NET_PERMISSIONS_DOC, " ,\n " ) + " .\n " },
160- }},
161- {RPCResult::Type::NUM, " minfeefilter" , " The minimum fee rate for transactions this peer accepts" },
162- {RPCResult::Type::OBJ_DYN, " bytessent_per_msg" , " " ,
163- {
164- {RPCResult::Type::NUM, " msg" , " The total bytes sent aggregated by message type\n "
165- " When a message type is not listed in this json object, the bytes sent are 0.\n "
166- " Only known message types can appear as keys in the object." }
167- }},
168- {RPCResult::Type::OBJ_DYN, " bytesrecv_per_msg" , " " ,
169- {
170- {RPCResult::Type::NUM, " msg" , " The total bytes received aggregated by message type\n "
171- " When a message type is not listed in this json object, the bytes received are 0.\n "
172- " Only known message types can appear as keys in the object and all bytes received\n "
173- " of unknown message types are listed under '" +NET_MESSAGE_COMMAND_OTHER+" '." }
174- }},
175- {RPCResult::Type::STR, " connection_type" , " Type of connection: \n " + Join (CONNECTION_TYPE_DOC, " ,\n " ) + " .\n "
176- " Please note this output is unlikely to be stable in upcoming releases as we iterate to\n "
177- " best capture connection behaviors." },
178- }},
119+ {RPCResult::Type::NUM, " id" , " Peer index" },
120+ {RPCResult::Type::STR, " addr" , " (host:port) The IP address and port of the peer" },
121+ {RPCResult::Type::STR, " addrbind" , /* optional */ true , " (ip:port) Bind address of the connection to the peer" },
122+ {RPCResult::Type::STR, " addrlocal" , /* optional */ true , " (ip:port) Local address as reported by the peer" },
123+ {RPCResult::Type::STR, " network" , " Network (" + Join (GetNetworkNames (/* append_unroutable */ true ), " , " ) + " )" },
124+ {RPCResult::Type::NUM, " mapped_as" , /* optional */ true , " The AS in the BGP route to the peer used for diversifying\n "
125+ " peer selection (only available if the asmap config flag is set)" },
126+ {RPCResult::Type::STR_HEX, " services" , " The services offered" },
127+ {RPCResult::Type::ARR, " servicesnames" , " the services offered, in human-readable form" ,
128+ {
129+ {RPCResult::Type::STR, " SERVICE_NAME" , " the service name if it is recognised" }
179130 }},
180- },
181- RPCExamples{
182- HelpExampleCli (" getpeerinfo" , " " )
131+ {RPCResult::Type::BOOL, " relaytxes" , " Whether peer has asked us to relay transactions to it" },
132+ {RPCResult::Type::NUM_TIME, " lastsend" , " The " + UNIX_EPOCH_TIME + " of the last send" },
133+ {RPCResult::Type::NUM_TIME, " lastrecv" , " The " + UNIX_EPOCH_TIME + " of the last receive" },
134+ {RPCResult::Type::NUM_TIME, " last_transaction" , " The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer" },
135+ {RPCResult::Type::NUM_TIME, " last_block" , " The " + UNIX_EPOCH_TIME + " of the last block received from this peer" },
136+ {RPCResult::Type::NUM, " bytessent" , " The total bytes sent" },
137+ {RPCResult::Type::NUM, " bytesrecv" , " The total bytes received" },
138+ {RPCResult::Type::NUM_TIME, " conntime" , " The " + UNIX_EPOCH_TIME + " of the connection" },
139+ {RPCResult::Type::NUM, " timeoffset" , " The time offset in seconds" },
140+ {RPCResult::Type::NUM, " pingtime" , /* optional */ true , " ping time (if available)" },
141+ {RPCResult::Type::NUM, " minping" , /* optional */ true , " minimum observed ping time (if any at all)" },
142+ {RPCResult::Type::NUM, " pingwait" , /* optional */ true , " ping wait (if non-zero)" },
143+ {RPCResult::Type::NUM, " version" , " The peer version, such as 70001" },
144+ {RPCResult::Type::STR, " subver" , " The string version" },
145+ {RPCResult::Type::BOOL, " inbound" , " Inbound (true) or Outbound (false)" },
146+ {RPCResult::Type::BOOL, " bip152_hb_to" , " Whether we selected peer as (compact blocks) high-bandwidth peer" },
147+ {RPCResult::Type::BOOL, " bip152_hb_from" , " Whether peer selected us as (compact blocks) high-bandwidth peer" },
148+ {RPCResult::Type::NUM, " startingheight" , /* optional=*/ true , " The starting height (block) of the peer" },
149+ {RPCResult::Type::NUM, " synced_headers" , /* optional=*/ true , " The last header we have in common with this peer" },
150+ {RPCResult::Type::NUM, " synced_blocks" , /* optional=*/ true , " The last block we have in common with this peer" },
151+ {RPCResult::Type::ARR, " inflight" , /* optional=*/ true , " " ,
152+ {
153+ {RPCResult::Type::NUM, " n" , " The heights of blocks we're currently asking from this peer" },
154+ }},
155+ {RPCResult::Type::BOOL, " addr_relay_enabled" , /* optional=*/ true , " Whether we participate in address relay with this peer" },
156+ {RPCResult::Type::NUM, " addr_processed" , /* optional=*/ true , " The total number of addresses processed, excluding those dropped due to rate limiting" },
157+ {RPCResult::Type::NUM, " addr_rate_limited" , /* optional=*/ true , " The total number of addresses dropped due to rate limiting" },
158+ {RPCResult::Type::ARR, " permissions" , " Any special permissions that have been granted to this peer" ,
159+ {
160+ {RPCResult::Type::STR, " permission_type" , Join (NET_PERMISSIONS_DOC, " ,\n " ) + " .\n " },
161+ }},
162+ {RPCResult::Type::NUM, " minfeefilter" , " The minimum fee rate for transactions this peer accepts" },
163+ {RPCResult::Type::OBJ_DYN, " bytessent_per_msg" , " " ,
164+ {
165+ {RPCResult::Type::NUM, " msg" , " The total bytes sent aggregated by message type\n "
166+ " When a message type is not listed in this json object, the bytes sent are 0.\n "
167+ " Only known message types can appear as keys in the object." }
168+ }},
169+ {RPCResult::Type::OBJ_DYN, " bytesrecv_per_msg" , " " ,
170+ {
171+ {RPCResult::Type::NUM, " msg" , " The total bytes received aggregated by message type\n "
172+ " When a message type is not listed in this json object, the bytes received are 0.\n "
173+ " Only known message types can appear as keys in the object and all bytes received\n "
174+ " of unknown message types are listed under '" +NET_MESSAGE_COMMAND_OTHER+" '." }
175+ }},
176+ {RPCResult::Type::STR, " connection_type" , " Type of connection: \n " + Join (CONNECTION_TYPE_DOC, " ,\n " ) + " .\n "
177+ " Please note this output is unlikely to be stable in upcoming releases as we iterate to\n "
178+ " best capture connection behaviors." },
179+ }},
180+ }},
181+ },
182+ RPCExamples{
183+ HelpExampleCli (" getpeerinfo" , " " )
183184 + HelpExampleRpc (" getpeerinfo" , " " )
184- },
185+ },
185186 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
186187{
187188 NodeContext& node = EnsureAnyNodeContext (request.context );
0 commit comments