Skip to content

Commit 3d84d7b

Browse files
committed
merge bitcoin#14033: Drop CADDR_TIME_VERSION checks now that MIN_PEER_PROTO_VERSION is greater
1 parent 4f5bd8d commit 3d84d7b

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

src/net.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3323,11 +3323,6 @@ CConnman::~CConnman()
33233323
Stop();
33243324
}
33253325

3326-
size_t CConnman::GetAddressCount() const
3327-
{
3328-
return addrman.size();
3329-
}
3330-
33313326
void CConnman::SetServices(const CService &addr, ServiceFlags nServices)
33323327
{
33333328
addrman.SetServices(addr, nServices);

src/net.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ friend class CNode;
399399
void RelayInvFiltered(CInv &inv, const uint256 &relatedTxHash, const int minProtoVersion = MIN_PEER_PROTO_VERSION);
400400

401401
// Addrman functions
402-
size_t GetAddressCount() const;
403402
void SetServices(const CService &addr, ServiceFlags nServices);
404403
void MarkAddressGood(const CAddress& addr);
405404
void AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty = 0);

src/net_processing.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman* connma
16021602
assert(nRelayNodes <= best.size());
16031603

16041604
auto sortfunc = [&best, &hasher, nRelayNodes, addr](CNode* pnode) {
1605-
if (pnode->nVersion >= CADDR_TIME_VERSION && pnode->IsAddrRelayPeer() && pnode->IsAddrCompatible(addr)) {
1605+
if (pnode->IsAddrRelayPeer() && pnode->IsAddrCompatible(addr)) {
16061606
uint64_t hashKey = CSipHasher(hasher).Write(pnode->GetId()).Finalize();
16071607
for (unsigned int i = 0; i < nRelayNodes; i++) {
16081608
if (hashKey > best[i].first) {
@@ -2762,11 +2762,8 @@ bool ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRec
27622762
}
27632763

27642764
// Get recent addresses
2765-
if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || connman->GetAddressCount() < 1000)
2766-
{
2767-
connman->PushMessage(pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
2768-
pfrom->fGetAddr = true;
2769-
}
2765+
connman->PushMessage(pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
2766+
pfrom->fGetAddr = true;
27702767
connman->MarkAddressGood(pfrom->addr);
27712768
}
27722769

@@ -2906,10 +2903,6 @@ bool ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRec
29062903

29072904
s >> vAddr;
29082905

2909-
// Don't want addr from older versions unless seeding
2910-
if (pfrom->nVersion < CADDR_TIME_VERSION && connman->GetAddressCount() > 1000)
2911-
return true;
2912-
29132906
if (!pfrom->IsAddrRelayPeer()) {
29142907
return true;
29152908
}
@@ -2954,7 +2947,6 @@ bool ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRec
29542947
pfrom->fGetAddr = false;
29552948
if (pfrom->fOneShot)
29562949
pfrom->fDisconnect = true;
2957-
statsClient.gauge("peers.knownAddresses", connman->GetAddressCount(), 1.0f);
29582950
return true;
29592951
}
29602952

0 commit comments

Comments
 (0)