Skip to content

Commit 3893da0

Browse files
committed
[RPC] Add field to getpeerinfo to indicate if addr relay is enabled
1 parent 0980ca7 commit 3893da0

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,7 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) c
12791279
stats.m_ping_wait = ping_wait;
12801280
stats.m_addr_processed = peer->m_addr_processed.load();
12811281
stats.m_addr_rate_limited = peer->m_addr_rate_limited.load();
1282+
stats.m_addr_relay_enabled = peer->m_addr_relay_enabled.load();
12821283

12831284
return true;
12841285
}

src/net_processing.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct CNodeStateStats {
3131
std::vector<int> vHeightInFlight;
3232
uint64_t m_addr_processed = 0;
3333
uint64_t m_addr_rate_limited = 0;
34+
bool m_addr_relay_enabled{false};
3435
};
3536

3637
class PeerManager : public CValidationInterface, public NetEventsInterface

src/rpc/net.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static RPCHelpMan getpeerinfo()
118118
{RPCResult::Type::STR, "addr", "(host:port) The IP address and port of the peer"},
119119
{RPCResult::Type::STR, "addrbind", "(ip:port) Bind address of the connection to the peer"},
120120
{RPCResult::Type::STR, "addrlocal", "(ip:port) Local address as reported by the peer"},
121+
{RPCResult::Type::BOOL, "addr_relay_enabled", "Whether we participate in address relay with this peer"},
121122
{RPCResult::Type::STR, "network", "Network (" + Join(GetNetworkNames(/* append_unroutable */ true), ", ") + ")"},
122123
{RPCResult::Type::NUM, "mapped_as", "The AS in the BGP route to the peer used for diversifying\n"
123124
"peer selection (only available if the asmap config flag is set)"},
@@ -201,6 +202,7 @@ static RPCHelpMan getpeerinfo()
201202
if (!(stats.addrLocal.empty())) {
202203
obj.pushKV("addrlocal", stats.addrLocal);
203204
}
205+
obj.pushKV("addr_relay_enabled", statestats.m_addr_relay_enabled);
204206
obj.pushKV("network", GetNetworkName(stats.m_network));
205207
if (stats.m_mapped_as != 0) {
206208
obj.pushKV("mapped_as", uint64_t(stats.m_mapped_as));

0 commit comments

Comments
 (0)