@@ -118,10 +118,10 @@ static RPCHelpMan getpeerinfo()
118118 {
119119 {RPCResult::Type::STR, " SERVICE_NAME" , " the service name if it is recognised" }
120120 }},
121- {RPCResult::Type::STR_HEX, " verified_proregtx_hash" , true /* optional */ , " Only present when the peer is a masternode and successfully "
121+ {RPCResult::Type::STR_HEX, " verified_proregtx_hash" , " Only present when the peer is a masternode and successfully "
122122 " authenticated via MNAUTH. In this case, this field contains the "
123123 " protx hash of the masternode" },
124- {RPCResult::Type::STR_HEX, " verified_pubkey_hash" , true /* optional */ , " Only present when the peer is a masternode and successfully "
124+ {RPCResult::Type::STR_HEX, " verified_pubkey_hash" , " Only present when the peer is a masternode and successfully "
125125 " authenticated via MNAUTH. In this case, this field contains the "
126126 " hash of the masternode's operator public key" },
127127 {RPCResult::Type::BOOL, " relaytxes" , " Whether peer has asked us to relay transactions to it" },
@@ -143,16 +143,16 @@ static RPCHelpMan getpeerinfo()
143143 {RPCResult::Type::BOOL, " bip152_hb_from" , " Whether peer selected us as (compact blocks) high-bandwidth peer" },
144144 {RPCResult::Type::BOOL, " masternode" , " Whether connection was due to masternode connection attempt" },
145145 {RPCResult::Type::NUM, " banscore" , " The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)" },
146- {RPCResult::Type::NUM, " startingheight" , /* optional= */ true , " The starting height (block) of the peer" },
147- {RPCResult::Type::NUM, " synced_headers" , /* optional= */ true , " The last header we have in common with this peer" },
148- {RPCResult::Type::NUM, " synced_blocks" , /* optional= */ true , " The last block we have in common with this peer" },
149- {RPCResult::Type::ARR, " inflight" , /* optional= */ true , " " ,
146+ {RPCResult::Type::NUM, " startingheight" , " The starting height (block) of the peer" },
147+ {RPCResult::Type::NUM, " synced_headers" , " The last header we have in common with this peer" },
148+ {RPCResult::Type::NUM, " synced_blocks" , " The last block we have in common with this peer" },
149+ {RPCResult::Type::ARR, " inflight" , " " ,
150150 {
151151 {RPCResult::Type::NUM, " n" , " The heights of blocks we're currently asking from this peer" },
152152 }},
153- {RPCResult::Type::BOOL, " addr_relay_enabled" , /* optional= */ true , " Whether we participate in address relay with this peer" },
154- {RPCResult::Type::NUM, " addr_processed" , /* optional= */ true , " The total number of addresses processed, excluding those dropped due to rate limiting" },
155- {RPCResult::Type::NUM, " addr_rate_limited" , /* optional= */ true , " The total number of addresses dropped due to rate limiting" },
153+ {RPCResult::Type::BOOL, " addr_relay_enabled" , " Whether we participate in address relay with this peer" },
154+ {RPCResult::Type::NUM, " addr_processed" , " The total number of addresses processed, excluding those dropped due to rate limiting" },
155+ {RPCResult::Type::NUM, " addr_rate_limited" , " The total number of addresses dropped due to rate limiting" },
156156 {RPCResult::Type::ARR, " permissions" , " Any special permissions that have been granted to this peer" ,
157157 {
158158 {RPCResult::Type::STR, " permission_type" , Join (NET_PERMISSIONS_DOC, " ,\n " ) + " .\n " },
@@ -216,9 +216,10 @@ static RPCHelpMan getpeerinfo()
216216 if (stats.m_mapped_as != 0 ) {
217217 obj.pushKV (" mapped_as" , uint64_t (stats.m_mapped_as ));
218218 }
219- ServiceFlags services{fStateStats ? statestats.their_services : ServiceFlags::NODE_NONE };
219+ ServiceFlags services{statestats.their_services };
220220 obj.pushKV (" services" , strprintf (" %016x" , services));
221221 obj.pushKV (" servicesnames" , GetServicesNames (services));
222+ obj.pushKV (" relaytxes" , statestats.m_relay_txs );
222223 if (!stats.verifiedProRegTxHash .IsNull ()) {
223224 obj.pushKV (" verified_proregtx_hash" , stats.verifiedProRegTxHash .ToString ());
224225 }
@@ -239,7 +240,7 @@ static RPCHelpMan getpeerinfo()
239240 if (stats.m_min_ping_time < std::chrono::microseconds::max ()) {
240241 obj.pushKV (" minping" , Ticks<SecondsDouble>(stats.m_min_ping_time ));
241242 }
242- if (fStateStats && statestats.m_ping_wait > 0s) {
243+ if (statestats.m_ping_wait > 0s) {
243244 obj.pushKV (" pingwait" , Ticks<SecondsDouble>(statestats.m_ping_wait ));
244245 }
245246 obj.pushKV (" version" , stats.nVersion );
@@ -251,24 +252,21 @@ static RPCHelpMan getpeerinfo()
251252 obj.pushKV (" bip152_hb_to" , stats.m_bip152_highbandwidth_to );
252253 obj.pushKV (" bip152_hb_from" , stats.m_bip152_highbandwidth_from );
253254 obj.pushKV (" masternode" , stats.m_masternode_connection );
254- if (fStateStats ) {
255- if (IsDeprecatedRPCEnabled (" banscore" )) {
256- // TODO: banscore is deprecated in v21 for removal in v22, maybe impossible due to usages in p2p_quorum_data.py
257- obj.pushKV (" banscore" , statestats.m_misbehavior_score );
258- }
259- obj.pushKV (" startingheight" , statestats.m_starting_height );
260- obj.pushKV (" synced_headers" , statestats.nSyncHeight );
261- obj.pushKV (" synced_blocks" , statestats.nCommonHeight );
262- UniValue heights (UniValue::VARR);
263- for (const int height : statestats.vHeightInFlight ) {
264- heights.push_back (height);
265- }
266- obj.pushKV (" inflight" , heights);
267- obj.pushKV (" relaytxes" , statestats.m_relay_txs );
268- obj.pushKV (" addr_relay_enabled" , statestats.m_addr_relay_enabled );
269- obj.pushKV (" addr_processed" , statestats.m_addr_processed );
270- obj.pushKV (" addr_rate_limited" , statestats.m_addr_rate_limited );
255+ if (IsDeprecatedRPCEnabled (" banscore" )) {
256+ // TODO: banscore is deprecated in v21 for removal in v22, maybe impossible due to usages in p2p_quorum_data.py
257+ obj.pushKV (" banscore" , statestats.m_misbehavior_score );
258+ }
259+ obj.pushKV (" startingheight" , statestats.m_starting_height );
260+ obj.pushKV (" synced_headers" , statestats.nSyncHeight );
261+ obj.pushKV (" synced_blocks" , statestats.nCommonHeight );
262+ UniValue heights (UniValue::VARR);
263+ for (const int height : statestats.vHeightInFlight ) {
264+ heights.push_back (height);
271265 }
266+ obj.pushKV (" inflight" , heights);
267+ obj.pushKV (" addr_relay_enabled" , statestats.m_addr_relay_enabled );
268+ obj.pushKV (" addr_processed" , statestats.m_addr_processed );
269+ obj.pushKV (" addr_rate_limited" , statestats.m_addr_rate_limited );
272270 UniValue permissions (UniValue::VARR);
273271 for (const auto & permission : NetPermissions::ToStrings (stats.m_permission_flags )) {
274272 permissions.push_back (permission);
0 commit comments