diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2022-04-26 10:45:10 +0200 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2022-09-05 17:52:08 +0200 |
commit | 2d0b4e4ff66e60c85f86c526a53f8fb242ebb7d0 (patch) | |
tree | 8121c24e1dd46bb61e7faf36c0b74d5ec2726bc6 /test/functional/feature_proxy.py | |
parent | 5291933fedceb9df16eb9e4627b1d7386b53ba07 (diff) | |
download | bitcoin-2d0b4e4ff66e60c85f86c526a53f8fb242ebb7d0.tar.xz |
init: allow startup with -onlynet=onion -listenonion=1
It does not make sense to specify `-onlynet=onion` without providing a
Tor proxy (even if other `-onlynet=...` are given). This is checked
during startup. However, it was forgotten that a Tor proxy can also be
retrieved from "Tor control" to which we connect if `-listenonion=1`.
So, the full Tor proxy retrieval logic is:
1. get it from `-onion`
2. get it from `-proxy`
3. if `-listenonion=1`, then connect to "Tor control" and get the proxy
from there (was forgotten before this change)
Fixes https://github.com/bitcoin/bitcoin/issues/24980
Diffstat (limited to 'test/functional/feature_proxy.py')
-rwxr-xr-x | test/functional/feature_proxy.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/test/functional/feature_proxy.py b/test/functional/feature_proxy.py index dd3cdc96ca..d02d56d068 100755 --- a/test/functional/feature_proxy.py +++ b/test/functional/feature_proxy.py @@ -332,20 +332,27 @@ class ProxyTest(BitcoinTestFramework): msg = "Error: Invalid -i2psam address or hostname: 'def:xyz'" self.nodes[1].assert_start_raises_init_error(expected_msg=msg) + self.log.info("Test passing -onlynet=onion with -onion=0/-noonion raises expected init error") msg = ( "Error: Outbound connections restricted to Tor (-onlynet=onion) but " - "the proxy for reaching the Tor network is not provided (no -proxy= " - "and no -onion= given) or it is explicitly forbidden (-onion=0)" + "the proxy for reaching the Tor network is explicitly forbidden: -onion=0" ) - self.log.info("Test passing -onlynet=onion without -proxy or -onion raises expected init error") - self.nodes[1].extra_args = ["-onlynet=onion"] - self.nodes[1].assert_start_raises_init_error(expected_msg=msg) - - self.log.info("Test passing -onlynet=onion with -onion=0/-noonion raises expected init error") for arg in ["-onion=0", "-noonion"]: self.nodes[1].extra_args = ["-onlynet=onion", arg] self.nodes[1].assert_start_raises_init_error(expected_msg=msg) + self.log.info("Test passing -onlynet=onion without -proxy, -onion or -listenonion raises expected init error") + self.nodes[1].extra_args = ["-onlynet=onion", "-listenonion=0"] + msg = ( + "Error: Outbound connections restricted to Tor (-onlynet=onion) but the proxy for " + "reaching the Tor network is not provided: none of -proxy, -onion or -listenonion is given" + ) + self.nodes[1].assert_start_raises_init_error(expected_msg=msg) + + self.log.info("Test passing -onlynet=onion without -proxy or -onion but with -listenonion=1 is ok") + self.start_node(1, extra_args=["-onlynet=onion", "-listenonion=1"]) + self.stop_node(1) + self.log.info("Test passing unknown network to -onlynet raises expected init error") self.nodes[1].extra_args = ["-onlynet=abc"] msg = "Error: Unknown network specified in -onlynet: 'abc'" |