mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
merge bitcoin#14033: Drop CADDR_TIME_VERSION checks now that MIN_PEER_PROTO_VERSION is greater
This commit is contained in:
parent
2d2814e5fa
commit
cca796aeb3
@ -3323,11 +3323,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);
|
||||||
|
@ -399,7 +399,6 @@ public:
|
|||||||
void RelayInvFiltered(CInv &inv, const uint256 &relatedTxHash, const int minProtoVersion = MIN_PEER_PROTO_VERSION);
|
void RelayInvFiltered(CInv &inv, const uint256 &relatedTxHash, const int minProtoVersion = MIN_PEER_PROTO_VERSION);
|
||||||
|
|
||||||
// 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);
|
||||||
|
@ -1603,7 +1603,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman& connma
|
|||||||
assert(nRelayNodes <= best.size());
|
assert(nRelayNodes <= best.size());
|
||||||
|
|
||||||
auto sortfunc = [&best, &hasher, nRelayNodes, addr](CNode* pnode) {
|
auto sortfunc = [&best, &hasher, nRelayNodes, addr](CNode* pnode) {
|
||||||
if (pnode->nVersion >= CADDR_TIME_VERSION && pnode->IsAddrRelayPeer() && pnode->IsAddrCompatible(addr)) {
|
if (pnode->IsAddrRelayPeer() && pnode->IsAddrCompatible(addr)) {
|
||||||
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) {
|
||||||
@ -2738,11 +2738,8 @@ void PeerLogicValidation::ProcessMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get recent addresses
|
// Get recent addresses
|
||||||
if (pfrom.fOneShot || pfrom.nVersion >= CADDR_TIME_VERSION || m_connman.GetAddressCount() < 1000)
|
|
||||||
{
|
|
||||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
|
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
|
||||||
pfrom.fGetAddr = true;
|
pfrom.fGetAddr = true;
|
||||||
}
|
|
||||||
m_connman.MarkAddressGood(pfrom.addr);
|
m_connman.MarkAddressGood(pfrom.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2882,10 +2879,6 @@ void PeerLogicValidation::ProcessMessage(
|
|||||||
|
|
||||||
s >> vAddr;
|
s >> vAddr;
|
||||||
|
|
||||||
// Don't want addr from older versions unless seeding
|
|
||||||
if (pfrom.nVersion < CADDR_TIME_VERSION && m_connman.GetAddressCount() > 1000)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!pfrom.IsAddrRelayPeer()) {
|
if (!pfrom.IsAddrRelayPeer()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2930,7 +2923,6 @@ void PeerLogicValidation::ProcessMessage(
|
|||||||
pfrom.fGetAddr = false;
|
pfrom.fGetAddr = false;
|
||||||
if (pfrom.fOneShot)
|
if (pfrom.fOneShot)
|
||||||
pfrom.fDisconnect = true;
|
pfrom.fDisconnect = true;
|
||||||
statsClient.gauge("peers.knownAddresses", m_connman.GetAddressCount(), 1.0f);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user