diff --git a/src/net.h b/src/net.h --- a/src/net.h +++ b/src/net.h @@ -840,13 +840,12 @@ // flood relay std::vector vAddrToSend; - std::unique_ptr m_addr_known; + const std::unique_ptr 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 to announce. // There is no final sorting before sending, as they are always sent diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -2902,9 +2902,11 @@ // 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), id(idIn), - nLocalHostNonce(nLocalHostNonceIn), nLocalServices(nLocalServicesIn), - nMyStartingHeight(nMyStartingHeightIn) { + m_addr_known{block_relay_only + ? nullptr + : std::make_unique(5000, 0.001)}, + id(idIn), nLocalHostNonce(nLocalHostNonceIn), + nLocalServices(nLocalServicesIn), nMyStartingHeight(nMyStartingHeightIn) { hSocket = hSocketIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; hashContinue = BlockHash(); @@ -2912,10 +2914,6 @@ m_tx_relay = std::make_unique(); } - if (m_addr_relay_peer) { - m_addr_known = std::make_unique(5000, 0.001); - } - for (const std::string &msg : getAllNetMessageTypes()) { mapRecvBytesPerMsgCmd[msg] = 0; }