mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-08-06 06:54:49 +02:00
Merge #14033: p2p: Drop CADDR_TIME_VERSION checks now that MIN_PEER_PROTO_VERSION is greater
57b0c0a93a
Drop CADDR_TIME_VERSION checks now that MIN_PEER_PROTO_VERSION is greater (Ben Woosley) Pull request description: We do not connect to peers older than 31800 ACKs for top commit: sipa: Code reivew ACK57b0c0a93a
jnewbery: Code review ACK57b0c0a93a
vasild: ACK57b0c0a9
Tree-SHA512: e1ca7c9203cbad83ab7c7a2312777ad07ed6a16119169b256648b8a8738c260a5168acdd4fb33f6e4b17f51ec7e033e110b76bde55b4e3b2d444dc02c01bc2b1
This commit is contained in:
commit
c0b0b0240f
@ -2511,11 +2511,6 @@ CConnman::~CConnman()
|
|||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CConnman::GetAddressCount() const
|
|
||||||
{
|
|
||||||
return addrman.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConnman::SetServices(const CService &addr, ServiceFlags nServices)
|
void CConnman::SetServices(const CService &addr, ServiceFlags nServices)
|
||||||
{
|
{
|
||||||
addrman.SetServices(addr, nServices);
|
addrman.SetServices(addr, nServices);
|
||||||
|
@ -247,7 +247,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Addrman functions
|
// Addrman functions
|
||||||
size_t GetAddressCount() const;
|
|
||||||
void SetServices(const CService &addr, ServiceFlags nServices);
|
void SetServices(const CService &addr, ServiceFlags nServices);
|
||||||
void MarkAddressGood(const CAddress& addr);
|
void MarkAddressGood(const CAddress& addr);
|
||||||
void AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty = 0);
|
void AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty = 0);
|
||||||
|
@ -1438,7 +1438,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, const CConnman&
|
|||||||
assert(nRelayNodes <= best.size());
|
assert(nRelayNodes <= best.size());
|
||||||
|
|
||||||
auto sortfunc = [&best, &hasher, nRelayNodes](CNode* pnode) {
|
auto sortfunc = [&best, &hasher, nRelayNodes](CNode* pnode) {
|
||||||
if (pnode->nVersion >= CADDR_TIME_VERSION && pnode->IsAddrRelayPeer()) {
|
if (pnode->IsAddrRelayPeer()) {
|
||||||
uint64_t hashKey = CSipHasher(hasher).Write(pnode->GetId()).Finalize();
|
uint64_t hashKey = CSipHasher(hasher).Write(pnode->GetId()).Finalize();
|
||||||
for (unsigned int i = 0; i < nRelayNodes; i++) {
|
for (unsigned int i = 0; i < nRelayNodes; i++) {
|
||||||
if (hashKey > best[i].first) {
|
if (hashKey > best[i].first) {
|
||||||
@ -2349,11 +2349,8 @@ void ProcessMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get recent addresses
|
// Get recent addresses
|
||||||
if (pfrom.fOneShot || pfrom.nVersion >= CADDR_TIME_VERSION || connman->GetAddressCount() < 1000)
|
connman->PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
|
||||||
{
|
pfrom.fGetAddr = true;
|
||||||
connman->PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
|
|
||||||
pfrom.fGetAddr = true;
|
|
||||||
}
|
|
||||||
connman->MarkAddressGood(pfrom.addr);
|
connman->MarkAddressGood(pfrom.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2443,9 +2440,6 @@ void ProcessMessage(
|
|||||||
std::vector<CAddress> vAddr;
|
std::vector<CAddress> vAddr;
|
||||||
vRecv >> vAddr;
|
vRecv >> vAddr;
|
||||||
|
|
||||||
// Don't want addr from older versions unless seeding
|
|
||||||
if (pfrom.nVersion < CADDR_TIME_VERSION && connman->GetAddressCount() > 1000)
|
|
||||||
return;
|
|
||||||
if (!pfrom.IsAddrRelayPeer()) {
|
if (!pfrom.IsAddrRelayPeer()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user