Skip to content

Commit 56f9dba

Browse files
committed
Only relay IPv4, IPv6, Tor addresses
1 parent 79f3d9b commit 56f9dba

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,7 @@ void RelayTransaction(const uint256& txid, const uint256& wtxid, const CConnman&
15281528

15291529
static void RelayAddress(const CAddress& addr, bool fReachable, const CConnman& connman)
15301530
{
1531+
if (!fReachable && !addr.IsRelayable()) return;
15311532

15321533
// Relay to a limited number of other nodes
15331534
// Use deterministic randomness to send to the same nodes for 24 hours

src/netaddress.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ class CNetAddr
211211
friend bool operator!=(const CNetAddr& a, const CNetAddr& b) { return !(a == b); }
212212
friend bool operator<(const CNetAddr& a, const CNetAddr& b);
213213

214+
/**
215+
* Whether this address should be relayed to other peers even if we can't reach it ourselves.
216+
*/
217+
bool IsRelayable() const
218+
{
219+
return IsIPv4() || IsIPv6() || IsTor();
220+
}
221+
214222
/**
215223
* Serialize to a stream.
216224
*/

0 commit comments

Comments
 (0)