Skip to content

Commit af59feb

Browse files
committed
[net/refactor] Extract m_addr_known logic from initializer list
1 parent e1bc298 commit af59feb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2748,7 +2748,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
27482748
// Don't relay addr messages to peers that we connect to as block-relay-only
27492749
// peers (to prevent adversaries from inferring these links from addr
27502750
// traffic).
2751-
m_addr_known{conn_type_in == ConnectionType::BLOCK_RELAY ? nullptr : MakeUnique<CRollingBloomFilter>(5000, 0.001)},
27522751
id(idIn),
27532752
nLocalHostNonce(nLocalHostNonceIn),
27542753
nLocalServices(nLocalServicesIn),
@@ -2759,6 +2758,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
27592758
hashContinue = uint256();
27602759
if (conn_type_in != ConnectionType::BLOCK_RELAY) {
27612760
m_tx_relay = MakeUnique<TxRelay>();
2761+
m_addr_known = MakeUnique<CRollingBloomFilter>(5000, 0.001);
27622762
}
27632763

27642764
for (const std::string &msg : getAllNetMessageTypes())

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ class CNode
799799

800800
// flood relay
801801
std::vector<CAddress> vAddrToSend;
802-
const std::unique_ptr<CRollingBloomFilter> m_addr_known;
802+
std::unique_ptr<CRollingBloomFilter> m_addr_known = nullptr;
803803
bool fGetAddr{false};
804804
std::chrono::microseconds m_next_addr_send GUARDED_BY(cs_sendProcessing){0};
805805
std::chrono::microseconds m_next_local_addr_send GUARDED_BY(cs_sendProcessing){0};

0 commit comments

Comments
 (0)