diff options
author | Pieter Wuille <pieter@wuille.net> | 2020-10-11 00:13:10 -0700 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2020-10-11 11:29:11 -0700 |
commit | 56f9dba015c592b8925795012e3061a710070a27 (patch) | |
tree | 008f2313c14b9a87d9a82ef3bc4df45e593faf0c | |
parent | 79f3d9b932bf62b90995bce1cf4b0b1f0152d26d (diff) |
Only relay IPv4, IPv6, Tor addresses
-rw-r--r-- | src/net_processing.cpp | 1 | ||||
-rw-r--r-- | src/netaddress.h | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 951b8a1811..9ad3f5d6f4 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -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) { + if (!fReachable && !addr.IsRelayable()) return; // Relay to a limited number of other nodes // Use deterministic randomness to send to the same nodes for 24 hours diff --git a/src/netaddress.h b/src/netaddress.h index 3bcf6d35ca..023e83e73d 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -212,6 +212,14 @@ class CNetAddr 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. */ template <typename Stream> |