Skip to content

Commit b6d2183

Browse files
naumenkogsMarcoFalke
andcommitted
Minor refactoring to remove implied m_addr_relay_peer.
Co-authored-by: MarcoFalke <[email protected]>
1 parent a552e84 commit b6d2183

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/net.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
26552655
// Don't relay addr messages to peers that we connect to as block-relay-only
26562656
// peers (to prevent adversaries from inferring these links from addr
26572657
// traffic).
2658-
m_addr_relay_peer(!block_relay_only),
2658+
m_addr_known{block_relay_only ? nullptr : MakeUnique<CRollingBloomFilter>(5000, 0.001)},
26592659
id(idIn),
26602660
nLocalHostNonce(nLocalHostNonceIn),
26612661
nLocalServices(nLocalServicesIn),
@@ -2668,10 +2668,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
26682668
m_tx_relay = MakeUnique<TxRelay>();
26692669
}
26702670

2671-
if (m_addr_relay_peer) {
2672-
m_addr_known = MakeUnique<CRollingBloomFilter>(5000, 0.001);
2673-
}
2674-
26752671
for (const std::string &msg : getAllNetMessageTypes())
26762672
mapRecvBytesPerMsgCmd[msg] = 0;
26772673
mapRecvBytesPerMsgCmd[NET_MESSAGE_COMMAND_OTHER] = 0;

src/net.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,13 +729,12 @@ class CNode
729729

730730
// flood relay
731731
std::vector<CAddress> vAddrToSend;
732-
std::unique_ptr<CRollingBloomFilter> m_addr_known;
732+
const std::unique_ptr<CRollingBloomFilter> m_addr_known;
733733
bool fGetAddr{false};
734734
int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0};
735735
int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0};
736736

737-
const bool m_addr_relay_peer;
738-
bool IsAddrRelayPeer() const { return m_addr_relay_peer; }
737+
bool IsAddrRelayPeer() const { return m_addr_known != nullptr; }
739738

740739
// List of block ids we still have announce.
741740
// There is no final sorting before sending, as they are always sent immediately

0 commit comments

Comments
 (0)