aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-09-10 21:48:57 -0400
committerglozow <gloriajzhao@gmail.com>2024-09-10 21:49:47 -0400
commit0725a374941355349bb4bc8a79dad1affb27d3b9 (patch)
treece1ccebafe669584000eb163beeaa57abec549e5
parentc66c68345efb0bb3d5613ebac703cde779fa0f01 (diff)
parent082779d6062c5b72f3497bb864e4dbb4373a3a4c (diff)
downloadbitcoin-0725a374941355349bb4bc8a79dad1affb27d3b9.tar.xz
Merge bitcoin/bitcoin#30805: test: Add explicit onion bind to p2p_permissions
082779d6062c5b72f3497bb864e4dbb4373a3a4c test: Add explicit onion bind to p2p_permissions (Ava Chow) Pull request description: When the bind option is replaced in the bitcoin.conf, bitcoind will attempd to bind to the default tor listening port. If another bitcoind is running that is already bound to that port, the bind will fail which, since #22729, causes the test to fail. This failure can be avoided by explicitly binding the tor port when the bind is removed. ACKs for top commit: tdb3: ACK 082779d6062c5b72f3497bb864e4dbb4373a3a4c theStack: re-ACK 082779d6062c5b72f3497bb864e4dbb4373a3a4c glozow: ACK 082779d6062c5b72f3497bb864e4dbb4373a3a4c Tree-SHA512: 4acb69ea2e00aeacf9e7c9ab9595ceaf0e0d2adbd795602034b2184197d9bad54c7bc9f3da43ef9c52a71869fe96ba8c87fc5b7c37880f258f5a2aaab2b4046c
-rwxr-xr-xtest/functional/p2p_permissions.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/p2p_permissions.py b/test/functional/p2p_permissions.py
index c881dd6ff4..c37061c307 100755
--- a/test/functional/p2p_permissions.py
+++ b/test/functional/p2p_permissions.py
@@ -14,8 +14,10 @@ from test_framework.p2p import P2PDataStore
from test_framework.test_node import ErrorMatch
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
+ append_config,
assert_equal,
p2p_port,
+ tor_port,
)
from test_framework.wallet import MiniWallet
@@ -57,11 +59,14 @@ class P2PPermissionsTests(BitcoinTestFramework):
# by modifying the configuration file.
ip_port = "127.0.0.1:{}".format(p2p_port(1))
self.nodes[1].replace_in_config([("bind=127.0.0.1", "whitebind=bloomfilter,forcerelay@" + ip_port)])
+ # Explicitly bind the tor port to prevent collisions with the default tor port
+ append_config(self.nodes[1].datadir_path, [f"bind=127.0.0.1:{tor_port(self.nodes[1].index)}=onion"])
self.checkpermission(
["-whitelist=noban@127.0.0.1"],
# Check parameter interaction forcerelay should activate relay
["noban", "bloomfilter", "forcerelay", "relay", "download"])
self.nodes[1].replace_in_config([("whitebind=bloomfilter,forcerelay@" + ip_port, "bind=127.0.0.1")])
+ self.nodes[1].replace_in_config([(f"bind=127.0.0.1:{tor_port(self.nodes[1].index)}=onion", "")])
self.checkpermission(
# legacy whitelistrelay should be ignored