You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
by passing an additional argument of "outonly" or "o".
This has been requested in order to keep the output within screen limits when running -netinfo
as a live dashboard, i.e. with `watch`.
Also allow passing "h" in addition to "help" to see the help documentation.
argsman.AddArg("-addrinfo", "Get the number of addresses known to the node, per network and total, after filtering for quality and recency. The total number of addresses known to the node may be higher.", ArgsManager::ALLOW_ANY, OptionsCategory::CLI_COMMANDS);
93
93
argsman.AddArg("-getinfo", "Get general information from the remote server. Note that unlike server-side RPC calls, the output of -getinfo is the result of multiple non-atomic requests. Some entries in the output may represent results from different states (e.g. wallet balance may be as of a different block from the chain state reported)", ArgsManager::ALLOW_ANY, OptionsCategory::CLI_COMMANDS);
94
-
argsman.AddArg("-netinfo", strprintf("Get network peer connection information from the remote server. An optional integer argument from 0 to %d can be passed for different peers listings (default: 0). Pass \"help\" for detailed help documentation.", NETINFO_MAX_LEVEL), ArgsManager::ALLOW_ANY, OptionsCategory::CLI_COMMANDS);
94
+
argsman.AddArg("-netinfo", strprintf("Get network peer connection information from the remote server. An optional argument from 0 to %d can be passed for different peers listings (default: 0). If a non-zero value is passed, an additional \"outonly\" (or \"o\") argument can be passed to see outbound peers only. Pass \"help\" (or \"h\") for detailed help documentation.", NETINFO_MAX_LEVEL), ArgsManager::ALLOW_ANY, OptionsCategory::CLI_COMMANDS);
95
95
96
96
SetupChainParamsBaseOptions(argsman);
97
97
argsman.AddArg("-color=<when>", strprintf("Color setting for CLI output (default: %s). Valid values: always, auto (add color codes when standard output is connected to a terminal and OS is not WIN32), never.", DEFAULT_COLOR_SETTING), ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::OPTIONS);
@@ -394,6 +394,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
throwstd::runtime_error(strprintf("invalid -netinfo outonly argument: %s\nThe outonly argument is only valid for details levels higher than 0. For more information, run: bitcoin-cli -netinfo help", args.at(1)));
492
+
}
483
493
}
484
494
}
485
495
UniValue result(UniValue::VARR);
@@ -514,6 +524,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
514
524
++m_counts.at(2).at(NETWORKS.size()); // total overall
515
525
if (conn_type == "block-relay-only") ++m_block_relay_peers_count;
516
526
if (conn_type == "manual") ++m_manual_peers_count;
527
+
if (m_outbound_only_selected && !is_outbound) continue;
517
528
if (DetailsRequested()) {
518
529
// Push data for this peer to the peers vector.
519
530
constint peer_id{peer["id"].getInt<int>()};
@@ -648,14 +659,15 @@ class NetinfoRequestHandler : public BaseRequestHandler
648
659
}
649
660
650
661
const std::string m_help_doc{
651
-
"-netinfo level|\"help\"\n\n"
662
+
"-netinfo level|outonly|help\n\n"
652
663
"Returns a network peer connections dashboard with information from the remote server.\n"
653
664
"This human-readable interface will change regularly and is not intended to be a stable API.\n"
654
665
"Under the hood, -netinfo fetches the data by calling getpeerinfo and getnetworkinfo.\n"
655
-
+ strprintf("An optional integer argument from 0 to %d can be passed for different peers listings; values from %d to 255 are parsed as %d.\n", NETINFO_MAX_LEVEL, NETINFO_MAX_LEVEL, NETINFO_MAX_LEVEL) +
656
-
"Pass \"help\" to see this detailed help documentation.\n"
657
-
"If more than one argument is passed, only the first one is read and parsed.\n"
658
-
"Suggestion: use with the Linux watch(1) command for a live dashboard; see example below.\n\n"
666
+
+ strprintf("An optional argument from 0 to %d can be passed for different peers listings; values above %d up to 255 are parsed as %d.\n", NETINFO_MAX_LEVEL, NETINFO_MAX_LEVEL, NETINFO_MAX_LEVEL) +
667
+
"If that argument is passed, an optional additional \"outonly\" argument may be passed to obtain the listing with outbound peers only.\n"
668
+
"Pass \"help\" or \"h\" to see this detailed help documentation.\n"
669
+
"If more than two arguments are passed, only the first two are read and parsed.\n"
670
+
"Suggestion: use -netinfo with the Linux watch(1) command for a live dashboard; see example below.\n\n"
659
671
"Arguments:\n"
660
672
+ strprintf("1. level (integer 0-%d, optional) Specify the info level of the peers dashboard (default 0):\n", NETINFO_MAX_LEVEL) +
661
673
" 0 - Peer counts for each reachable network as well as for block relay peers\n"
@@ -664,7 +676,9 @@ class NetinfoRequestHandler : public BaseRequestHandler
664
676
" 2 - Like 1 but with an address column\n"
665
677
" 3 - Like 1 but with a version column\n"
666
678
" 4 - Like 1 but with both address and version columns\n"
667
-
"2. help (string \"help\", optional) Print this help documentation instead of the dashboard.\n\n"
679
+
"2. outonly (\"outonly\" or \"o\", optional) Return the peers listing with outbound peers only, i.e. to save screen space\n"
680
+
" when a node has many inbound peers. Only valid if a level is passed.\n\n"
681
+
"help (\"help\" or \"h\", optional) Print this help documentation instead of the dashboard.\n\n"
668
682
"Result:\n\n"
669
683
+ strprintf("* The peers listing in levels 1-%d displays all of the peers sorted by direction and minimum ping time:\n\n", NETINFO_MAX_LEVEL) +
670
684
" Column Description\n"
@@ -717,6 +731,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
0 commit comments