aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUser <naumenko.gs@gmail.com>2019-10-31 13:42:02 -0400
committerUser <naumenko.gs@gmail.com>2019-10-31 13:42:02 -0400
commitb6d2183858975abc961207c125c15791e531edcc (patch)
tree65b9ce2916c7e30a61768d37940368dfec5d4a4e
parenta552e8477c5bcd22a5457f4f73a2fd6db8acd2c2 (diff)
downloadbitcoin-b6d2183858975abc961207c125c15791e531edcc.tar.xz
Minor refactoring to remove implied m_addr_relay_peer.
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
-rw-r--r--src/net.cpp6
-rw-r--r--src/net.h5
2 files changed, 3 insertions, 8 deletions
diff --git a/src/net.cpp b/src/net.cpp
index df52689092..0415386c0d 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2655,7 +2655,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
// Don't relay addr messages to peers that we connect to as block-relay-only
// peers (to prevent adversaries from inferring these links from addr
// traffic).
- m_addr_relay_peer(!block_relay_only),
+ m_addr_known{block_relay_only ? nullptr : MakeUnique<CRollingBloomFilter>(5000, 0.001)},
id(idIn),
nLocalHostNonce(nLocalHostNonceIn),
nLocalServices(nLocalServicesIn),
@@ -2668,10 +2668,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
m_tx_relay = MakeUnique<TxRelay>();
}
- if (m_addr_relay_peer) {
- m_addr_known = MakeUnique<CRollingBloomFilter>(5000, 0.001);
- }
-
for (const std::string &msg : getAllNetMessageTypes())
mapRecvBytesPerMsgCmd[msg] = 0;
mapRecvBytesPerMsgCmd[NET_MESSAGE_COMMAND_OTHER] = 0;
diff --git a/src/net.h b/src/net.h
index 95193a09db..5bca789219 100644
--- a/src/net.h
+++ b/src/net.h
@@ -729,13 +729,12 @@ public:
// flood relay
std::vector<CAddress> vAddrToSend;
- std::unique_ptr<CRollingBloomFilter> m_addr_known;
+ const std::unique_ptr<CRollingBloomFilter> m_addr_known;
bool fGetAddr{false};
int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0};
int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0};
- const bool m_addr_relay_peer;
- bool IsAddrRelayPeer() const { return m_addr_relay_peer; }
+ bool IsAddrRelayPeer() const { return m_addr_known != nullptr; }
// List of block ids we still have announce.
// There is no final sorting before sending, as they are always sent immediately