diff options
author | User <naumenko.gs@gmail.com> | 2019-10-16 17:06:20 -0400 |
---|---|---|
committer | User <naumenko.gs@gmail.com> | 2019-10-16 17:06:20 -0400 |
commit | 090b75c14be6b9ba2efe38a17d141c6e6af575cb (patch) | |
tree | a19fd9414b69ae3e0b5a5ac70804e5537e7c5539 /src/net.h | |
parent | c34b88620dc8435b83e6744895f2ecd3c9ec8de7 (diff) |
p2p: Avoid allocating memory for addrKnown where we don't need it
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -729,7 +729,7 @@ public: // flood relay std::vector<CAddress> vAddrToSend; - CRollingBloomFilter addrKnown; + 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}; @@ -884,7 +884,7 @@ public: void AddAddressKnown(const CAddress& _addr) { - addrKnown.insert(_addr.GetKey()); + m_addr_known->insert(_addr.GetKey()); } void PushAddress(const CAddress& _addr, FastRandomContext &insecure_rand) @@ -892,7 +892,7 @@ public: // Known checking here is only to save space from duplicates. // SendMessages will filter it again for knowns that were added // after addresses were pushed. - if (_addr.IsValid() && !addrKnown.contains(_addr.GetKey())) { + if (_addr.IsValid() && !m_addr_known->contains(_addr.GetKey())) { if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) { vAddrToSend[insecure_rand.randrange(vAddrToSend.size())] = _addr; } else { |