Skip to content

Commit 4885d6f

Browse files
addrman, refactor: move count increment into Create()
Create() is only called in one spot, so this doesn't change behavior. Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
1 parent c77c877 commit 4885d6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/addrman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ AddrInfo* AddrManImpl::Create(const CAddress& addr, const CNetAddr& addrSource,
427427
mapAddr[addr] = nId;
428428
mapInfo[nId].nRandomPos = vRandom.size();
429429
vRandom.push_back(nId);
430+
nNew++;
431+
m_network_counts[addr.GetNetwork()].n_new++;
430432
if (pnId)
431433
*pnId = nId;
432434
return &mapInfo[nId];
@@ -598,8 +600,6 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, std::c
598600
} else {
599601
pinfo = Create(addr, source, &nId);
600602
pinfo->nTime = std::max(NodeSeconds{0s}, pinfo->nTime - time_penalty);
601-
nNew++;
602-
m_network_counts[pinfo->GetNetwork()].n_new++;
603603
}
604604

605605
int nUBucket = pinfo->GetNewBucket(nKey, source, m_netgroupman);

0 commit comments

Comments
 (0)