Skip to content

Commit 218862a

Browse files
committed
Display peers in -netinfo that we don't relay addresses to
i.e. peers where getpeerinfo#addr_relay_enabled is false
1 parent 3834e23 commit 218862a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bitcoin-cli.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
407407
int id;
408408
int mapped_as;
409409
int version;
410+
bool is_addr_relay_enabled;
410411
bool is_bip152_hb_from;
411412
bool is_bip152_hb_to;
412413
bool is_block_relay;
@@ -499,9 +500,10 @@ class NetinfoRequestHandler : public BaseRequestHandler
499500
const std::string addr{peer["addr"].get_str()};
500501
const std::string age{conn_time == 0 ? "" : ToString((m_time_now - conn_time) / 60)};
501502
const std::string sub_version{peer["subver"].get_str()};
503+
const bool is_addr_relay_enabled{peer["addr_relay_enabled"].isNull() ? false : peer["addr_relay_enabled"].get_bool()};
502504
const bool is_bip152_hb_from{peer["bip152_hb_from"].get_bool()};
503505
const bool is_bip152_hb_to{peer["bip152_hb_to"].get_bool()};
504-
m_peers.push_back({addr, sub_version, conn_type, network, age, min_ping, ping, addr_processed, addr_rate_limited, last_blck, last_recv, last_send, last_trxn, peer_id, mapped_as, version, is_bip152_hb_from, is_bip152_hb_to, is_block_relay, is_outbound});
506+
m_peers.push_back({addr, sub_version, conn_type, network, age, min_ping, ping, addr_processed, addr_rate_limited, last_blck, last_recv, last_send, last_trxn, peer_id, mapped_as, version, is_addr_relay_enabled, is_bip152_hb_from, is_bip152_hb_to, is_block_relay, is_outbound});
505507
m_max_addr_length = std::max(addr.length() + 1, m_max_addr_length);
506508
m_max_addr_processed_length = std::max(ToString(addr_processed).length(), m_max_addr_processed_length);
507509
m_max_addr_rate_limited_length = std::max(ToString(addr_rate_limited).length(), m_max_addr_rate_limited_length);
@@ -538,7 +540,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
538540
peer.last_blck ? ToString((m_time_now - peer.last_blck) / 60) : "",
539541
strprintf("%s%s", peer.is_bip152_hb_to ? "." : " ", peer.is_bip152_hb_from ? "*" : " "),
540542
m_max_addr_processed_length, // variable spacing
541-
peer.addr_processed ? ToString(peer.addr_processed) : "",
543+
peer.addr_processed ? ToString(peer.addr_processed) : peer.is_addr_relay_enabled ? "" : ".",
542544
m_max_addr_rate_limited_length, // variable spacing
543545
peer.addr_rate_limited ? ToString(peer.addr_rate_limited) : "",
544546
m_max_age_length, // variable spacing
@@ -631,6 +633,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
631633
" \".\" (to) - we selected the peer as a high-bandwidth peer\n"
632634
" \"*\" (from) - the peer selected us as a high-bandwidth peer\n"
633635
" addrp Total number of addresses processed, excluding those dropped due to rate limiting\n"
636+
" \".\" - we do not relay addresses to this peer (addr_relay_enabled is false)\n"
634637
" addrl Total number of addresses dropped due to rate limiting\n"
635638
" age Duration of connection to the peer, in minutes\n"
636639
" asmap Mapped AS (Autonomous System) number in the BGP route to the peer, used for diversifying\n"

0 commit comments

Comments
 (0)