From 090b75c14be6b9ba2efe38a17d141c6e6af575cb Mon Sep 17 00:00:00 2001 From: User Date: Wed, 16 Oct 2019 17:06:20 -0400 Subject: p2p: Avoid allocating memory for addrKnown where we don't need it --- src/net_processing.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/net_processing.cpp') diff --git a/src/net_processing.cpp b/src/net_processing.cpp index b6839dcf21..188c3d777e 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1315,7 +1315,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman* connma // Relay to a limited number of other nodes // Use deterministic randomness to send to the same nodes for 24 hours - // at a time so the addrKnowns of the chosen nodes prevent repeats + // at a time so the m_addr_knowns of the chosen nodes prevent repeats uint64_t hashAddr = addr.GetHash(); const CSipHasher hasher = connman->GetDeterministicRandomizer(RANDOMIZER_ID_ADDRESS_RELAY).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60)); FastRandomContext insecure_rand; @@ -3563,9 +3563,9 @@ bool PeerLogicValidation::SendMessages(CNode* pto) vAddr.reserve(pto->vAddrToSend.size()); for (const CAddress& addr : pto->vAddrToSend) { - if (!pto->addrKnown.contains(addr.GetKey())) + if (!pto->m_addr_known->contains(addr.GetKey())) { - pto->addrKnown.insert(addr.GetKey()); + pto->m_addr_known->insert(addr.GetKey()); vAddr.push_back(addr); // receiver rejects addr messages larger than 1000 if (vAddr.size() >= 1000) -- cgit v1.2.3 From a552e8477c5bcd22a5457f4f73a2fd6db8acd2c2 Mon Sep 17 00:00:00 2001 From: User Date: Fri, 25 Oct 2019 16:28:14 -0400 Subject: added asserts to check m_addr_known when it's used --- src/net_processing.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/net_processing.cpp') diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 188c3d777e..c1743c2e32 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3561,6 +3561,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto) pto->nNextAddrSend = PoissonNextSend(nNow, AVG_ADDRESS_BROADCAST_INTERVAL); std::vector vAddr; vAddr.reserve(pto->vAddrToSend.size()); + assert(pto->m_addr_known); for (const CAddress& addr : pto->vAddrToSend) { if (!pto->m_addr_known->contains(addr.GetKey())) -- cgit v1.2.3