Only relay IPv4, IPv6, Tor addresses

This commit is contained in:
Pieter Wuille committed 2020-10-11 11:29:11 -07:00
1 parent 79f3d9b932
commit 56f9dba015
2 files changed
+9

No files matched your search

+1
View File
@@ -1528,6 +1528,7 @@ void RelayTransaction(const uint256& txid, const uint256& wtxid, const CConnman&
static void RelayAddress(const CAddress& addr, bool fReachable, const CConnman& connman) static void RelayAddress(const CAddress& addr, bool fReachable, const CConnman& connman)
{ {
if (!fReachable && !addr.IsRelayable()) return;
// Relay to a limited number of other nodes // Relay to a limited number of other nodes
// Use deterministic randomness to send to the same nodes for 24 hours // Use deterministic randomness to send to the same nodes for 24 hours
+8
View File
@@ -211,6 +211,14 @@ class CNetAddr
friend bool operator!=(const CNetAddr& a, const CNetAddr& b) { return !(a == b); } friend bool operator!=(const CNetAddr& a, const CNetAddr& b) { return !(a == b); }
friend bool operator<(const CNetAddr& a, const CNetAddr& b); friend bool operator<(const CNetAddr& a, const CNetAddr& b);
/**
* Whether this address should be relayed to other peers even if we can't reach it ourselves.
*/
bool IsRelayable() const
{
return IsIPv4() || IsIPv6() || IsTor();
}
/** /**
* Serialize to a stream. * Serialize to a stream.
*/ */