Skip to content

Commit ddb14fe

Browse files
fanquakePastaPastaPasta
authored andcommitted
Merge bitcoin#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
1 parent f0d217a commit ddb14fe

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

doc/bips.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BIPs that are implemented by Bitcoin Core, some of them are relevant for Dash Core, some are just mentioned as a reference.
2-
Specified versions, PRs are relevant to Bitcoin's core.
2+
Versions and PRs are relevant to Bitcoin's core if not mentioned other.
33

44
* [`BIP 9`](https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki): The changes allowing multiple soft-forks to be deployed in parallel have been implemented since **v0.12.1** ([PR #7575](https://github.com/bitcoin/bitcoin/pull/7575))
55
* [`BIP 11`](https://github.com/bitcoin/bips/blob/master/bip-0011.mediawiki): Multisig outputs are standard since **v0.6.0** ([PR #669](https://github.com/bitcoin/bitcoin/pull/669)).
@@ -38,7 +38,7 @@ Specified versions, PRs are relevant to Bitcoin's core.
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)).
4040
* [`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 **v18.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 **v18.0** ([PR #14121](https://github.com/bitcoin/bitcoin/pull/14121)).
41+
* [`BIP 158`](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki): Compact Block Filters for Light Clients can be indexed as of **Dash Core v18.0** ([PR dash#4314](https://github.com/dashpay/dash/pull/4314), [PR #14121](https://github.com/bitcoin/bitcoin/pull/14121)).
4242
* [`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)).
4343
* [`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 **v18.0** ([PR 13557](https://github.com/bitcoin/bitcoin/pull/13557)).
4444
* [`BIP 339`](https://github.com/bitcoin/bips/blob/master/bip-0339.mediawiki): Relay of transactions by wtxid is supported as of **v0.21.0** ([PR 18044](https://github.com/bitcoin/bitcoin/pull/18044)).

src/net_processing.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,8 @@ void PeerManagerImpl::RelayTransaction(const uint256& txid)
18961896

18971897
static void RelayAddress(const CAddress& addr, bool fReachable, const CConnman& connman)
18981898
{
1899+
if (!fReachable && !addr.IsRelayable()) return;
1900+
18991901
// Relay to a limited number of other nodes
19001902
// Use deterministic randomness to send to the same nodes for 24 hours
19011903
// at a time so the m_addr_knowns of the chosen nodes prevent repeats

src/netaddress.h

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

230+
/**
231+
* Whether this address should be relayed to other peers even if we can't reach it ourselves.
232+
*/
233+
bool IsRelayable() const
234+
{
235+
return IsIPv4() || IsIPv6() || IsTor();
236+
}
237+
230238
/**
231239
* Serialize to a stream.
232240
*/

0 commit comments

Comments
 (0)