Skip to content

Commit a552e84

Browse files
committed
added asserts to check m_addr_known when it's used
1 parent 090b75c commit a552e84

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/net.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ class CNode
884884

885885
void AddAddressKnown(const CAddress& _addr)
886886
{
887+
assert(m_addr_known);
887888
m_addr_known->insert(_addr.GetKey());
888889
}
889890

@@ -892,6 +893,7 @@ class CNode
892893
// Known checking here is only to save space from duplicates.
893894
// SendMessages will filter it again for knowns that were added
894895
// after addresses were pushed.
896+
assert(m_addr_known);
895897
if (_addr.IsValid() && !m_addr_known->contains(_addr.GetKey())) {
896898
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
897899
vAddrToSend[insecure_rand.randrange(vAddrToSend.size())] = _addr;

src/net_processing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3561,6 +3561,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
35613561
pto->nNextAddrSend = PoissonNextSend(nNow, AVG_ADDRESS_BROADCAST_INTERVAL);
35623562
std::vector<CAddress> vAddr;
35633563
vAddr.reserve(pto->vAddrToSend.size());
3564+
assert(pto->m_addr_known);
35643565
for (const CAddress& addr : pto->vAddrToSend)
35653566
{
35663567
if (!pto->m_addr_known->contains(addr.GetKey()))

0 commit comments

Comments
 (0)