@@ -303,6 +303,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
303
303
static constexpr uint8_t m_networks_size{3 };
304
304
const std::array<std::string, m_networks_size> m_networks{{" ipv4" , " ipv6" , " onion" }};
305
305
std::array<std::array<uint16_t , m_networks_size + 2 >, 3 > m_counts{{{}}}; // !< Peer counts by (in/out/total, networks/total/block-relay)
306
+ uint8_t m_manual_peers_count{0 };
306
307
int8_t NetworkStringToId (const std::string& str) const
307
308
{
308
309
for (uint8_t i = 0 ; i < m_networks_size; ++i) {
@@ -405,7 +406,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
405
406
" address IP address and port of the peer\n "
406
407
" version Peer version and subversion concatenated, e.g. \" 70016/Satoshi:21.0.0/\"\n\n "
407
408
" * The connection counts table displays the number of peers by direction, network, and the totals\n "
408
- " for each, as well as a column for block relay peers.\n\n "
409
+ " for each, as well as two special outbound columns for block relay peers and manual peers.\n\n "
409
410
" * The local addresses table lists each local address broadcast by the node, the port, and the score.\n\n "
410
411
" Examples:\n\n "
411
412
" Connection counts and local addresses only\n "
@@ -473,6 +474,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
473
474
++m_counts.at (is_outbound).at (m_networks_size + 1 ); // in/out block-relay
474
475
++m_counts.at (2 ).at (m_networks_size + 1 ); // total block-relay
475
476
}
477
+ if (conn_type == " manual" ) ++m_manual_peers_count;
476
478
if (DetailsRequested ()) {
477
479
// Push data for this peer to the peers vector.
478
480
const int peer_id{peer[" id" ].get_int ()};
@@ -532,14 +534,16 @@ class NetinfoRequestHandler : public BaseRequestHandler
532
534
}
533
535
534
536
// Report peer connection totals by type.
535
- result += " ipv4 ipv6 onion total block-relay\n " ;
537
+ result += " ipv4 ipv6 onion total block" ;
538
+ if (m_manual_peers_count) result += " manual" ;
536
539
const std::array<std::string, 3 > rows{{" in" , " out" , " total" }};
537
540
for (uint8_t i = 0 ; i < m_networks_size; ++i) {
538
- result += strprintf (" %-5s %5i %5i %5i %5i %5i\n " , rows.at (i), m_counts.at (i).at (0 ), m_counts.at (i).at (1 ), m_counts.at (i).at (2 ), m_counts.at (i).at (m_networks_size), m_counts.at (i).at (m_networks_size + 1 ));
541
+ result += strprintf (" \n %-5s %5i %5i %5i %5i %5i" , rows.at (i), m_counts.at (i).at (0 ), m_counts.at (i).at (1 ), m_counts.at (i).at (2 ), m_counts.at (i).at (m_networks_size), m_counts.at (i).at (m_networks_size + 1 ));
542
+ if (i == 1 && m_manual_peers_count) result += strprintf (" %5i" , m_manual_peers_count);
539
543
}
540
544
541
545
// Report local addresses, ports, and scores.
542
- result += " \n Local addresses" ;
546
+ result += " \n\ n Local addresses" ;
543
547
const std::vector<UniValue>& local_addrs{networkinfo[" localaddresses" ].getValues ()};
544
548
if (local_addrs.empty ()) {
545
549
result += " : n/a\n " ;
0 commit comments