Skip to content

Commit af22322

Browse files
committed
Merge #20119: BIP155 follow-ups
56f9dba Only relay IPv4, IPv6, Tor addresses (Pieter Wuille) 79f3d9b Mention BIP155 in doc/bips.md (Pieter Wuille) Pull request description: This: * Documents BIP155 support in doc/bips.md * Restricts addrv2 relay to IPv4, IPv6, and Tor addresses. Relaying addresses in ranges that no network software has support for seems like a gratuitous spam vector. ACKs for top commit: jonatack: ACK 56f9dba naumenkogs: ACK 56f9dba hebasto: ACK 56f9dba, verified both links. Tree-SHA512: f0a2072b3d84a05cdbc7b961c18d7322a2e7260517f5306599ff52d8c728f9167de0a59a6d66cb95d84d69f3028680ce8bd05dab0db8c4f97938a287e5ce9631
2 parents 0b2abaa + 56f9dba commit af22322

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

doc/bips.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.21.0**):
3737
* [`BIP 145`](https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki): getblocktemplate updates for Segregated Witness as of **v0.13.0** ([PR 8149](https://github.com/bitcoin/bitcoin/pull/8149)).
3838
* [`BIP 147`](https://github.com/bitcoin/bips/blob/master/bip-0147.mediawiki): NULLDUMMY softfork as of **v0.13.1** ([PR 8636](https://github.com/bitcoin/bitcoin/pull/8636) and [PR 8937](https://github.com/bitcoin/bitcoin/pull/8937)), *buried* since **v0.19.0** ([PR #16060](https://github.com/bitcoin/bitcoin/pull/16060)).
3939
* [`BIP 152`](https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki): Compact block transfer and related optimizations are used as of **v0.13.0** ([PR 8068](https://github.com/bitcoin/bitcoin/pull/8068)).
40-
- [`BIP 158`](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki): Compact Block Filters for Light Clients can be indexed as of **v0.19.0** ([PR #14121](https://github.com/bitcoin/bitcoin/pull/14121)).
40+
* [`BIP 155`](https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki): The 'addrv2' and 'sendaddrv2' messages which enable relay of Tor V3 addresses (and other networks) are supported as of **v0.21.0** ([PR 19954](https://github.com/bitcoin/bitcoin/pull/19954)).
41+
* [`BIP 158`](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki): Compact Block Filters for Light Clients can be indexed as of **v0.19.0** ([PR #14121](https://github.com/bitcoin/bitcoin/pull/14121)).
4142
* [`BIP 159`](https://github.com/bitcoin/bips/blob/master/bip-0159.mediawiki): The `NODE_NETWORK_LIMITED` service bit is signalled as of **v0.16.0** ([PR 11740](https://github.com/bitcoin/bitcoin/pull/11740)), and such nodes are connected to as of **v0.17.0** ([PR 10387](https://github.com/bitcoin/bitcoin/pull/10387)).
4243
* [`BIP 173`](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki): Bech32 addresses for native Segregated Witness outputs are supported as of **v0.16.0** ([PR 11167](https://github.com/bitcoin/bitcoin/pull/11167)). Bech32 addresses are generated by default as of **v0.20.0** ([PR 16884](https://github.com/bitcoin/bitcoin/pull/16884)).
4344
* [`BIP 174`](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki): RPCs to operate on Partially Signed Bitcoin Transactions (PSBT) are present as of **v0.17.0** ([PR 13557](https://github.com/bitcoin/bitcoin/pull/13557)).

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)