aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-02-02 15:03:05 +0100
committerJon Atack <jon@atack.com>2021-02-03 14:18:20 +0100
commit747cb5b9949f80b3b4516f382a0ce80e41f3f5a6 (patch)
treec51482788cae7efc3ee802de9779a9497e69b7e8 /src/bitcoin-cli.cpp
parent76d198a5c15a9376c7d3a91754320334337a9e50 (diff)
downloadbitcoin-747cb5b9949f80b3b4516f382a0ce80e41f3f5a6.tar.xz
netinfo: display only outbound block relay counts
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 74be0bddb2..a9a0ec6f5d 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -303,7 +303,8 @@ private:
static constexpr int8_t NET_I2P{3}; // pos of "i2p" in m_networks
static constexpr uint8_t m_networks_size{4};
const std::array<std::string, m_networks_size> m_networks{{"ipv4", "ipv6", "onion", "i2p"}};
- std::array<std::array<uint16_t, m_networks_size + 2>, 3> m_counts{{{}}}; //!< Peer counts by (in/out/total, networks/total/block-relay)
+ std::array<std::array<uint16_t, m_networks_size + 1>, 3> m_counts{{{}}}; //!< Peer counts by (in/out/total, networks/total)
+ uint8_t m_block_relay_peers_count{0};
uint8_t m_manual_peers_count{0};
int8_t NetworkStringToId(const std::string& str) const
{
@@ -478,10 +479,7 @@ public:
++m_counts.at(is_outbound).at(m_networks_size); // in/out overall
++m_counts.at(2).at(network_id); // total by network
++m_counts.at(2).at(m_networks_size); // total overall
- if (conn_type == "block-relay-only") {
- ++m_counts.at(is_outbound).at(m_networks_size + 1); // in/out block-relay
- ++m_counts.at(2).at(m_networks_size + 1); // total block-relay
- }
+ if (conn_type == "block-relay-only") ++m_block_relay_peers_count;
if (conn_type == "manual") ++m_manual_peers_count;
if (DetailsRequested()) {
// Push data for this peer to the peers vector.
@@ -553,8 +551,11 @@ public:
for (uint8_t i = 0; i < 3; ++i) {
result += strprintf("\n%-5s %5i %5i %5i", rows.at(i), m_counts.at(i).at(0), m_counts.at(i).at(1), m_counts.at(i).at(2)); // ipv4/ipv6/onion peers counts
if (m_is_i2p_on) result += strprintf(" %5i", m_counts.at(i).at(3)); // i2p peers count
- result += strprintf(" %5i %5i", m_counts.at(i).at(m_networks_size), m_counts.at(i).at(m_networks_size + 1));
- if (i == 1 && m_manual_peers_count) result += strprintf(" %5i", m_manual_peers_count);
+ result += strprintf(" %5i", m_counts.at(i).at(m_networks_size)); // total peers count
+ if (i == 1) { // the outbound row has two extra columns for block relay and manual peer counts
+ result += strprintf(" %5i", m_block_relay_peers_count);
+ if (m_manual_peers_count) result += strprintf(" %5i", m_manual_peers_count);
+ }
}
// Report local addresses, ports, and scores.