aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Zumsande <mzumsande@gmail.com>2023-01-16 15:59:11 -0500
committerMartin Zumsande <mzumsande@gmail.com>2023-01-26 18:11:13 -0500
commit4885d6f197736cb89fdfac250b280ec10829d903 (patch)
treea0013b40ad8c49f86db1bce238872573d414b56c
parentc77c877a8e916878e09f64b2faa12eeca7528cc8 (diff)
downloadbitcoin-4885d6f197736cb89fdfac250b280ec10829d903.tar.xz
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>
-rw-r--r--src/addrman.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp
index 89da34c419..4ffb7617b0 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -427,6 +427,8 @@ AddrInfo* AddrManImpl::Create(const CAddress& addr, const CNetAddr& addrSource,
mapAddr[addr] = nId;
mapInfo[nId].nRandomPos = vRandom.size();
vRandom.push_back(nId);
+ nNew++;
+ m_network_counts[addr.GetNetwork()].n_new++;
if (pnId)
*pnId = nId;
return &mapInfo[nId];
@@ -598,8 +600,6 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, std::c
} else {
pinfo = Create(addr, source, &nId);
pinfo->nTime = std::max(NodeSeconds{0s}, pinfo->nTime - time_penalty);
- nNew++;
- m_network_counts[pinfo->GetNetwork()].n_new++;
}
int nUBucket = pinfo->GetNewBucket(nKey, source, m_netgroupman);