Skip to content

Commit 513e107

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#22616: p2p, rpc: address relay fixups
5e33f76 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 5e33f76 jnewbery: ACK 5e33f76 Tree-SHA512: b42f33c615b14079e2c4e6060209de8707d71b351dd1e11e04a2a6fc12d15747d0c5d9b24850217080fd1ef92e63f96d6925c4badf280b781edd696c349be7d6
2 parents 5b2d866 + 5e33f76 commit 513e107

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ class PeerManagerImpl final : public PeerManager
653653
* @return True if address relay is enabled with peer
654654
* False if address relay is disallowed
655655
*/
656-
bool SetupAddressRelay(CNode& node, Peer& peer);
656+
bool SetupAddressRelay(const CNode& node, Peer& peer);
657657
};
658658
} // namespace
659659

@@ -4466,7 +4466,7 @@ class CompareInvMempoolOrder
44664466
};
44674467
}
44684468

4469-
bool PeerManagerImpl::SetupAddressRelay(CNode& node, Peer& peer)
4469+
bool PeerManagerImpl::SetupAddressRelay(const CNode& node, Peer& peer)
44704470
{
44714471
// We don't participate in addr relay with outbound block-relay-only
44724472
// connections to prevent providing adversaries with the additional

src/rpc/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ 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"},
122121
{RPCResult::Type::STR, "network", "Network (" + Join(GetNetworkNames(/* append_unroutable */ true), ", ") + ")"},
123122
{RPCResult::Type::NUM, "mapped_as", "The AS in the BGP route to the peer used for diversifying\n"
124123
"peer selection (only available if the asmap config flag is set)"},
@@ -151,6 +150,7 @@ static RPCHelpMan getpeerinfo()
151150
{
152151
{RPCResult::Type::NUM, "n", "The heights of blocks we're currently asking from this peer"},
153152
}},
153+
{RPCResult::Type::BOOL, "addr_relay_enabled", "Whether we participate in address relay with this peer"},
154154
{RPCResult::Type::ARR, "permissions", "Any special permissions that have been granted to this peer",
155155
{
156156
{RPCResult::Type::STR, "permission_type", Join(NET_PERMISSIONS_DOC, ",\n") + ".\n"},
@@ -202,7 +202,6 @@ static RPCHelpMan getpeerinfo()
202202
if (!(stats.addrLocal.empty())) {
203203
obj.pushKV("addrlocal", stats.addrLocal);
204204
}
205-
obj.pushKV("addr_relay_enabled", statestats.m_addr_relay_enabled);
206205
obj.pushKV("network", GetNetworkName(stats.m_network));
207206
if (stats.m_mapped_as != 0) {
208207
obj.pushKV("mapped_as", uint64_t(stats.m_mapped_as));
@@ -244,6 +243,7 @@ static RPCHelpMan getpeerinfo()
244243
heights.push_back(height);
245244
}
246245
obj.pushKV("inflight", heights);
246+
obj.pushKV("addr_relay_enabled", statestats.m_addr_relay_enabled);
247247
obj.pushKV("addr_processed", statestats.m_addr_processed);
248248
obj.pushKV("addr_rate_limited", statestats.m_addr_rate_limited);
249249
}

0 commit comments

Comments
 (0)