mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-03 08:21:29 +02:00
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>
This commit is contained in:
parent
c77c877a8e
commit
4885d6f197
@ -427,6 +427,8 @@ AddrInfo* AddrManImpl::Create(const CAddress& addr, const CNetAddr& addrSource,
|
|||||||
mapAddr[addr] = nId;
|
mapAddr[addr] = nId;
|
||||||
mapInfo[nId].nRandomPos = vRandom.size();
|
mapInfo[nId].nRandomPos = vRandom.size();
|
||||||
vRandom.push_back(nId);
|
vRandom.push_back(nId);
|
||||||
|
nNew++;
|
||||||
|
m_network_counts[addr.GetNetwork()].n_new++;
|
||||||
if (pnId)
|
if (pnId)
|
||||||
*pnId = nId;
|
*pnId = nId;
|
||||||
return &mapInfo[nId];
|
return &mapInfo[nId];
|
||||||
@ -598,8 +600,6 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, std::c
|
|||||||
} else {
|
} else {
|
||||||
pinfo = Create(addr, source, &nId);
|
pinfo = Create(addr, source, &nId);
|
||||||
pinfo->nTime = std::max(NodeSeconds{0s}, pinfo->nTime - time_penalty);
|
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);
|
int nUBucket = pinfo->GetNewBucket(nKey, source, m_netgroupman);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user