aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-08-04 17:17:49 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-08-04 17:17:55 +0200
commit513e1071a189ccbc65de98b6ee1a4fd17bb04af7 (patch)
treef7a9d4e4a48d3b148c48f8822e96bcaa99b5446f /src
parent5b2d8661c906ea1bc7afd904aad9b04a691d86cd (diff)
parent5e33f762d44557a1e3f0ff3c280d8a3ab98e3867 (diff)
downloadbitcoin-513e1071a189ccbc65de98b6ee1a4fd17bb04af7.tar.xz
Merge bitcoin/bitcoin#22616: p2p, rpc: address relay fixups
5e33f762d44557a1e3f0ff3c280d8a3ab98e3867 p2p, rpc: address relay fixups (Jon Atack) Pull request description: Following review of new changes merged today, move a use of `statestats` in getpeerinfo to within the section guarded by `if (fStateStats)`, e.g. `PeerManagerImpl::GetNodeStateStats` true, and pass an in-param by reference to const. ACKs for top commit: amitiuttarwar: ACK 5e33f762d4 jnewbery: ACK 5e33f762d44557a1e3f0ff3c280d8a3ab98e3867 Tree-SHA512: b42f33c615b14079e2c4e6060209de8707d71b351dd1e11e04a2a6fc12d15747d0c5d9b24850217080fd1ef92e63f96d6925c4badf280b781edd696c349be7d6
Diffstat (limited to 'src')
-rw-r--r--src/net_processing.cpp4
-rw-r--r--src/rpc/net.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 777473c7be..9da2fe5d6f 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -653,7 +653,7 @@ private:
* @return True if address relay is enabled with peer
* False if address relay is disallowed
*/
- bool SetupAddressRelay(CNode& node, Peer& peer);
+ bool SetupAddressRelay(const CNode& node, Peer& peer);
};
} // namespace
@@ -4466,7 +4466,7 @@ public:
};
}
-bool PeerManagerImpl::SetupAddressRelay(CNode& node, Peer& peer)
+bool PeerManagerImpl::SetupAddressRelay(const CNode& node, Peer& peer)
{
// We don't participate in addr relay with outbound block-relay-only
// connections to prevent providing adversaries with the additional
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 3962a13924..abc9ec3ce3 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -118,7 +118,6 @@ static RPCHelpMan getpeerinfo()
{RPCResult::Type::STR, "addr", "(host:port) The IP address and port of the peer"},
{RPCResult::Type::STR, "addrbind", "(ip:port) Bind address of the connection to the peer"},
{RPCResult::Type::STR, "addrlocal", "(ip:port) Local address as reported by the peer"},
- {RPCResult::Type::BOOL, "addr_relay_enabled", "Whether we participate in address relay with this peer"},
{RPCResult::Type::STR, "network", "Network (" + Join(GetNetworkNames(/* append_unroutable */ true), ", ") + ")"},
{RPCResult::Type::NUM, "mapped_as", "The AS in the BGP route to the peer used for diversifying\n"
"peer selection (only available if the asmap config flag is set)"},
@@ -151,6 +150,7 @@ static RPCHelpMan getpeerinfo()
{
{RPCResult::Type::NUM, "n", "The heights of blocks we're currently asking from this peer"},
}},
+ {RPCResult::Type::BOOL, "addr_relay_enabled", "Whether we participate in address relay with this peer"},
{RPCResult::Type::ARR, "permissions", "Any special permissions that have been granted to this peer",
{
{RPCResult::Type::STR, "permission_type", Join(NET_PERMISSIONS_DOC, ",\n") + ".\n"},
@@ -202,7 +202,6 @@ static RPCHelpMan getpeerinfo()
if (!(stats.addrLocal.empty())) {
obj.pushKV("addrlocal", stats.addrLocal);
}
- obj.pushKV("addr_relay_enabled", statestats.m_addr_relay_enabled);
obj.pushKV("network", GetNetworkName(stats.m_network));
if (stats.m_mapped_as != 0) {
obj.pushKV("mapped_as", uint64_t(stats.m_mapped_as));
@@ -244,6 +243,7 @@ static RPCHelpMan getpeerinfo()
heights.push_back(height);
}
obj.pushKV("inflight", heights);
+ obj.pushKV("addr_relay_enabled", statestats.m_addr_relay_enabled);
obj.pushKV("addr_processed", statestats.m_addr_processed);
obj.pushKV("addr_rate_limited", statestats.m_addr_rate_limited);
}