Skip to content

Commit

Permalink
Only relay IPv4, IPv6, Tor addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa authored and furszy committed Aug 10, 2021
1 parent 015298c commit f44be94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ static void RelayTransaction(const CTransaction& tx, CConnman* connman)

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

// Relay to a limited number of other nodes
Expand Down
8 changes: 8 additions & 0 deletions src/netaddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ class CNetAddr
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.
*/
Expand Down

0 comments on commit f44be94

Please sign in to comment.