@@ -379,7 +379,7 @@ class GetinfoRequestHandler: public BaseRequestHandler
379
379
class NetinfoRequestHandler : public BaseRequestHandler
380
380
{
381
381
private:
382
- static constexpr uint8_t MAX_DETAIL_LEVEL{4 };
382
+ static constexpr uint8_t MAX_DETAIL_LEVEL{5 };
383
383
std::array<std::array<uint16_t , NETWORKS.size() + 1 >, 3 > m_counts{{{}}}; // !< Peer counts by (in/out/total, networks/total)
384
384
uint8_t m_block_relay_peers_count{0 };
385
385
uint8_t m_manual_peers_count{0 };
@@ -391,9 +391,10 @@ class NetinfoRequestHandler : public BaseRequestHandler
391
391
return UNKNOWN_NETWORK;
392
392
}
393
393
uint8_t m_details_level{0 }; // !< Optional user-supplied arg to set dashboard details level
394
- bool DetailsRequested () const { return m_details_level > 0 && m_details_level < 5 ; }
395
- bool IsAddressSelected () const { return m_details_level == 2 || m_details_level == 4 ; }
396
- bool IsVersionSelected () const { return m_details_level == 3 || m_details_level == 4 ; }
394
+ bool DetailsRequested () const { return m_details_level > 0 && m_details_level <= MAX_DETAIL_LEVEL; }
395
+ bool IsAddressSelected () const { return m_details_level == 2 || m_details_level >= 4 ; }
396
+ bool IsVersionSelected () const { return m_details_level >= 3 ; }
397
+ bool OutboundOnlySelected () const { return m_details_level == 5 ; }
397
398
bool m_is_asmap_on{false };
398
399
size_t m_max_addr_length{0 };
399
400
size_t m_max_addr_processed_length{5 };
@@ -477,7 +478,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
477
478
if (!args.empty ()) {
478
479
uint8_t n{0 };
479
480
if (ParseUInt8 (args.at (0 ), &n)) {
480
- m_details_level = std::min (n, MAX_DETAIL_LEVEL);
481
+ m_details_level = (n <= MAX_DETAIL_LEVEL) ? n : 4 ;
481
482
} else {
482
483
throw std::runtime_error (strprintf (" invalid -netinfo argument: %s\n For more information, run: bitcoin-cli -netinfo help" , args.at (0 )));
483
484
}
@@ -514,6 +515,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
514
515
++m_counts.at (2 ).at (NETWORKS.size ()); // total overall
515
516
if (conn_type == " block-relay-only" ) ++m_block_relay_peers_count;
516
517
if (conn_type == " manual" ) ++m_manual_peers_count;
518
+ if (!is_outbound && OutboundOnlySelected ()) continue ;
517
519
if (DetailsRequested ()) {
518
520
// Push data for this peer to the peers vector.
519
521
const int peer_id{peer[" id" ].getInt <int >()};
@@ -664,6 +666,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
664
666
" 2 - Like 1 but with an address column\n "
665
667
" 3 - Like 1 but with a version column\n "
666
668
" 4 - Like 1 but with both address and version columns\n "
669
+ " 5 - Like 4 but limited to outbound peers only, to save screen space\n "
667
670
" 2. help (string \" help\" , optional) Print this help documentation instead of the dashboard.\n\n "
668
671
" Result:\n\n "
669
672
+ strprintf (" * The peers listing in levels 1-%d displays all of the peers sorted by direction and minimum ping time:\n\n " , MAX_DETAIL_LEVEL) +
0 commit comments