Skip to content

Commit 56ce78d

Browse files
committed
Merge bitcoin/bitcoin#34031: net: Remove "tor" as a network specification
e7ac5a1 doc: add release note for 34031 (fanquake) c4c70a2 netbase: Remove "tor" as a network specification (Carl Dong) Pull request description: "tor" as a network specification was deprecated in 60dc8e4 in favor of "onion" and this commit removes it and updates the relevant test. Previously #16029. This has been warning as being deprecated since `v0.17.0`. This PR only removes the already deprecated usage of tor as a network specification, the use of tor throughout the codebase, is not deprecated. ACKs for top commit: davidgumberg: crACK bitcoin/bitcoin@e7ac5a1 laanwj: Code review ACK e7ac5a1 janb84: ACK e7ac5a1 stickies-v: ACK e7ac5a1 Tree-SHA512: f211dec151c21728b4cd2b1716ee68907871beaa85d8c89e2bc17576e701d03c03e5455593de94970d787aa3264fab60d8c6debeeff908e00d8feb48804692e9
2 parents 500862b + e7ac5a1 commit 56ce78d

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

doc/release-notes-34031.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Net
2+
---
3+
- `tor` has been removed as a network specification. It
4+
was deprecated in favour of `onion` in v0.17.0. (#34031)

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
16831683
ipv4_proxy = name_proxy = proxy;
16841684
} else if (net_str == "ipv6") {
16851685
ipv6_proxy = name_proxy = proxy;
1686-
} else if (net_str == "tor" || net_str == "onion") {
1686+
} else if (net_str == "onion") {
16871687
onion_proxy = proxy;
16881688
} else if (net_str == "cjdns") {
16891689
cjdns_proxy = proxy;

src/netbase.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2022 The Bitcoin Core developers
2+
// Copyright (c) 2009-present The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -102,10 +102,6 @@ enum Network ParseNetwork(const std::string& net_in) {
102102
if (net == "ipv4") return NET_IPV4;
103103
if (net == "ipv6") return NET_IPV6;
104104
if (net == "onion") return NET_ONION;
105-
if (net == "tor") {
106-
LogWarning("Net name 'tor' is deprecated and will be removed in the future. You should use 'onion' instead.");
107-
return NET_ONION;
108-
}
109105
if (net == "i2p") {
110106
return NET_I2P;
111107
}

src/test/netbase_tests.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2012-2022 The Bitcoin Core developers
1+
// Copyright (c) 2012-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -348,17 +348,20 @@ BOOST_AUTO_TEST_CASE(netbase_parsenetwork)
348348
BOOST_CHECK_EQUAL(ParseNetwork("ipv4"), NET_IPV4);
349349
BOOST_CHECK_EQUAL(ParseNetwork("ipv6"), NET_IPV6);
350350
BOOST_CHECK_EQUAL(ParseNetwork("onion"), NET_ONION);
351-
BOOST_CHECK_EQUAL(ParseNetwork("tor"), NET_ONION);
352351
BOOST_CHECK_EQUAL(ParseNetwork("cjdns"), NET_CJDNS);
353352

354353
BOOST_CHECK_EQUAL(ParseNetwork("IPv4"), NET_IPV4);
355354
BOOST_CHECK_EQUAL(ParseNetwork("IPv6"), NET_IPV6);
356355
BOOST_CHECK_EQUAL(ParseNetwork("ONION"), NET_ONION);
357-
BOOST_CHECK_EQUAL(ParseNetwork("TOR"), NET_ONION);
358356
BOOST_CHECK_EQUAL(ParseNetwork("CJDNS"), NET_CJDNS);
359357

358+
// "tor" as a network specification was deprecated in 60dc8e4208 in favor of
359+
// "onion" and later removed.
360+
BOOST_CHECK_EQUAL(ParseNetwork("tor"), NET_UNROUTABLE);
361+
BOOST_CHECK_EQUAL(ParseNetwork("TOR"), NET_UNROUTABLE);
362+
360363
BOOST_CHECK_EQUAL(ParseNetwork(":)"), NET_UNROUTABLE);
361-
BOOST_CHECK_EQUAL(ParseNetwork("tÖr"), NET_UNROUTABLE);
364+
BOOST_CHECK_EQUAL(ParseNetwork("oniÖn"), NET_UNROUTABLE);
362365
BOOST_CHECK_EQUAL(ParseNetwork("\xfe\xff"), NET_UNROUTABLE);
363366
BOOST_CHECK_EQUAL(ParseNetwork(""), NET_UNROUTABLE);
364367
}

test/functional/feature_proxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ def networks_dict(d):
468468
assert_equal(nets["ipv6"]["proxy"], "127.6.6.6:6666")
469469
self.stop_node(1)
470470

471-
self.log.info("Test overriding the Tor proxy")
472-
self.start_node(1, extra_args=["-proxy=127.1.1.1:1111", "-proxy=127.2.2.2:2222=tor"])
471+
self.log.info("Test overriding the Onion proxy")
472+
self.start_node(1, extra_args=["-proxy=127.1.1.1:1111", "-proxy=127.2.2.2:2222=onion"])
473473
nets = networks_dict(self.nodes[1].getnetworkinfo())
474474
assert_equal(nets["ipv4"]["proxy"], "127.1.1.1:1111")
475475
assert_equal(nets["ipv6"]["proxy"], "127.1.1.1:1111")

0 commit comments

Comments
 (0)