Skip to content

Commit f44be94

Browse files
sipafurszy
authored andcommitted
Only relay IPv4, IPv6, Tor addresses
1 parent 015298c commit f44be94

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
@@ -822,6 +822,7 @@ static void RelayTransaction(const CTransaction& tx, CConnman* connman)
822822

823823
static void RelayAddress(const CAddress& addr, bool fReachable, CConnman* connman)
824824
{
825+
if (!fReachable && !addr.IsRelayable()) return;
825826
int nRelayNodes = fReachable ? 2 : 1; // limited relaying of addresses outside our network(s)
826827

827828
// Relay to a limited number of other nodes

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);
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)