aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_i2p_ports.py
diff options
context:
space:
mode:
authorbrunoerg <brunoely.gc@gmail.com>2024-02-06 14:06:52 -0300
committerbrunoerg <brunoely.gc@gmail.com>2024-02-08 18:33:16 -0300
commit5b358cdd1a5f5d2fe87a9e41c638996eab2e2796 (patch)
tree1ffe1462133c1056a28d4d033fc59912dafa7099 /test/functional/p2p_i2p_ports.py
parent4de84557d6d1f53255ab19f27c8b6ea0a712934a (diff)
downloadbitcoin-5b358cdd1a5f5d2fe87a9e41c638996eab2e2796.tar.xz
i2p: log connection was refused due to arbitrary port
Diffstat (limited to 'test/functional/p2p_i2p_ports.py')
-rwxr-xr-xtest/functional/p2p_i2p_ports.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/test/functional/p2p_i2p_ports.py b/test/functional/p2p_i2p_ports.py
index 13188b9305..20dcb50a57 100755
--- a/test/functional/p2p_i2p_ports.py
+++ b/test/functional/p2p_i2p_ports.py
@@ -6,36 +6,28 @@
Test ports handling for I2P hosts
"""
-import re
from test_framework.test_framework import BitcoinTestFramework
+PROXY = "127.0.0.1:60000"
class I2PPorts(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
# The test assumes that an I2P SAM proxy is not listening here.
- self.extra_args = [["-i2psam=127.0.0.1:60000"]]
+ self.extra_args = [[f"-i2psam={PROXY}"]]
def run_test(self):
node = self.nodes[0]
self.log.info("Ensure we don't try to connect if port!=0")
addr = "zsxwyo6qcn3chqzwxnseusqgsnuw3maqnztkiypyfxtya4snkoka.b32.i2p:8333"
- raised = False
- try:
- with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}"]):
- node.addnode(node=addr, command="onetry")
- except AssertionError as e:
- raised = True
- if not re.search(r"Expected messages .* does not partially match log", str(e)):
- raise AssertionError(f"Assertion raised as expected, but with an unexpected message: {str(e)}")
- if not raised:
- raise AssertionError("Assertion should have been raised")
+ with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}, connection refused due to arbitrary port 8333"]):
+ node.addnode(node=addr, command="onetry")
self.log.info("Ensure we try to connect if port=0 and get an error due to missing I2P proxy")
addr = "h3r6bkn46qxftwja53pxiykntegfyfjqtnzbm6iv6r5mungmqgmq.b32.i2p:0"
- with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}"]):
+ with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}: Cannot connect to {PROXY}"]):
node.addnode(node=addr, command="onetry")