v29.4-roots.4 · Commit 3: [PATCH 03/37] policy: restore conservative relay and network controls
test/functional/feature_proxy.py
Before: test/functional/feature_proxy.py · After: test/functional/feature_proxy.py
File metadata
index 644ee5cc7f2b5c3bc5f676835657eae0a53f23dc..7c671259d0fcd17ae15c4d7beaae20d0d23f1f03 100755
Download original patch · Release notes
Diff rows 1–55 of 55. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/feature_proxy.py
CHANGED
|
@@ -437,13 +437,54 @@ class ProxyTest(BitcoinTestFramework):
|
|
| 437 |
|
| 438 |
self.log.info("Test passing -onlynet=onion without -proxy or -onion but with -listenonion=1 is ok")
|
| 439 |
self.start_node(1, extra_args=["-onlynet=onion", "-listenonion=1"])
|
| 440 |
-
self.stop_node(1)
|
| 441 |
|
| 442 |
self.log.info("Test passing unknown network to -onlynet raises expected init error")
|
| 443 |
self.nodes[1].extra_args = ["-onlynet=abc"]
|
| 444 |
msg = "Error: Unknown network specified in -onlynet: 'abc'"
|
| 445 |
self.nodes[1].assert_start_raises_init_error(expected_msg=msg)
|
| 446 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
self.log.info("Test passing too-long unix path to -proxy raises init error")
|
| 448 |
self.nodes[1].extra_args = [f"-proxy=unix:{'x' * 1000}"]
|
| 449 |
if self.have_unix_sockets:
|
|
|
|
| 437 |
|
| 438 |
self.log.info("Test passing -onlynet=onion without -proxy or -onion but with -listenonion=1 is ok")
|
| 439 |
self.start_node(1, extra_args=["-onlynet=onion", "-listenonion=1"])
|
| 440 |
+
self.stop_node(1, expected_stderr=f'Warning: You are using a common listening port (127.0.0.1:{p2p_port(1)}) for both Tor and local connections. All connections to this port will be assumed to be Tor connections, and will be denied any whitelist permissions. If this is not your intent, setup a separate -bind=<addr>[:<port>]=onion configuration, or set -listenonion=0.')
|
| 441 |
|
| 442 |
self.log.info("Test passing unknown network to -onlynet raises expected init error")
|
| 443 |
self.nodes[1].extra_args = ["-onlynet=abc"]
|
| 444 |
msg = "Error: Unknown network specified in -onlynet: 'abc'"
|
| 445 |
self.nodes[1].assert_start_raises_init_error(expected_msg=msg)
|
| 446 |
|
| 447 |
+
self.log.info("Test passing trailing '=' raises expected init error")
|
| 448 |
+
self.nodes[1].extra_args = ["-proxy=127.0.0.1:9050="]
|
| 449 |
+
msg = "Error: Invalid -proxy address or hostname, ends with '=': '127.0.0.1:9050='"
|
| 450 |
+
self.nodes[1].assert_start_raises_init_error(expected_msg=msg)
|
| 451 |
+
|
| 452 |
+
self.log.info("Test passing unrecognized network raises expected init error")
|
| 453 |
+
self.nodes[1].extra_args = ["-proxy=127.0.0.1:9050=foo"]
|
| 454 |
+
msg = "Error: Unrecognized network in -proxy='127.0.0.1:9050=foo': 'foo'"
|
| 455 |
+
self.nodes[1].assert_start_raises_init_error(expected_msg=msg)
|
| 456 |
+
|
| 457 |
+
self.log.info("Test passing proxy only for IPv6")
|
| 458 |
+
self.start_node(1, extra_args=["-proxy=127.6.6.6:6666=ipv6"])
|
| 459 |
+
nets = networks_dict(self.nodes[1].getnetworkinfo())
|
| 460 |
+
assert_equal(nets["ipv4"]["proxy"], "")
|
| 461 |
+
assert_equal(nets["ipv6"]["proxy"], "127.6.6.6:6666")
|
| 462 |
+
self.stop_node(1)
|
| 463 |
+
|
| 464 |
+
self.log.info("Test passing separate proxy for IPv4 and IPv6")
|
| 465 |
+
self.start_node(1, extra_args=["-proxy=127.4.4.4:4444=ipv4", "-proxy=127.6.6.6:6666=ipv6"])
|
| 466 |
+
nets = networks_dict(self.nodes[1].getnetworkinfo())
|
| 467 |
+
assert_equal(nets["ipv4"]["proxy"], "127.4.4.4:4444")
|
| 468 |
+
assert_equal(nets["ipv6"]["proxy"], "127.6.6.6:6666")
|
| 469 |
+
self.stop_node(1)
|
| 470 |
+
|
| 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"])
|
| 473 |
+
nets = networks_dict(self.nodes[1].getnetworkinfo())
|
| 474 |
+
assert_equal(nets["ipv4"]["proxy"], "127.1.1.1:1111")
|
| 475 |
+
assert_equal(nets["ipv6"]["proxy"], "127.1.1.1:1111")
|
| 476 |
+
assert_equal(nets["onion"]["proxy"], "127.2.2.2:2222")
|
| 477 |
+
self.stop_node(1)
|
| 478 |
+
|
| 479 |
+
self.log.info("Test removing CJDNS proxy")
|
| 480 |
+
self.start_node(1, extra_args=["-proxy=127.1.1.1:1111", "-proxy=0=cjdns"])
|
| 481 |
+
nets = networks_dict(self.nodes[1].getnetworkinfo())
|
| 482 |
+
assert_equal(nets["ipv4"]["proxy"], "127.1.1.1:1111")
|
| 483 |
+
assert_equal(nets["ipv6"]["proxy"], "127.1.1.1:1111")
|
| 484 |
+
assert_equal(nets["onion"]["proxy"], "127.1.1.1:1111")
|
| 485 |
+
assert_equal(nets["cjdns"]["proxy"], "")
|
| 486 |
+
self.stop_node(1)
|
| 487 |
+
|
| 488 |
self.log.info("Test passing too-long unix path to -proxy raises init error")
|
| 489 |
self.nodes[1].extra_args = [f"-proxy=unix:{'x' * 1000}"]
|
| 490 |
if self.have_unix_sockets:
|