aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_timeouts.py
diff options
context:
space:
mode:
authorMartin Zumsande <mzumsande@gmail.com>2023-11-20 15:10:29 -0500
committerMartin Zumsande <mzumsande@gmail.com>2024-02-12 10:46:42 -0500
commitbf5662c678455fb47c402f8520215726ddfe7a94 (patch)
tree3b74b5f7760d1d7759bc567a8c59218f1b8ad215 /test/functional/p2p_timeouts.py
parent6e9e39da434f8dafacee4cba068daf499bdb4cc2 (diff)
downloadbitcoin-bf5662c678455fb47c402f8520215726ddfe7a94.tar.xz
test: enable v2 for python p2p depending on global --v2transport flag
This changes the default behavior, individual tests can overwrite this option. As a result, it is possible to run the entire test suite with --v2transport, and all connections to the python p2p will then use it. Also adjust several tests that are already running with --v2transport in the test runner (although they actually made v1 connection before this change). This is done in the same commit so that there isn't an intermediate commit in which the CI fails.
Diffstat (limited to 'test/functional/p2p_timeouts.py')
-rwxr-xr-xtest/functional/p2p_timeouts.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/test/functional/p2p_timeouts.py b/test/functional/p2p_timeouts.py
index b4fa5099d8..80d7b6e9ae 100755
--- a/test/functional/p2p_timeouts.py
+++ b/test/functional/p2p_timeouts.py
@@ -69,11 +69,8 @@ class TimeoutsTest(BitcoinTestFramework):
with self.nodes[0].assert_debug_log(['Unsupported message "ping" prior to verack from peer=0']):
no_verack_node.send_message(msg_ping())
- # With v2, non-version messages before the handshake would be interpreted as part of the key exchange.
- # Therefore, don't execute this part of the test if v2transport is chosen.
- if not self.options.v2transport:
- with self.nodes[0].assert_debug_log(['non-version message before version handshake. Message "ping" from peer=1']):
- no_version_node.send_message(msg_ping())
+ with self.nodes[0].assert_debug_log(['non-version message before version handshake. Message "ping" from peer=1']):
+ no_version_node.send_message(msg_ping())
self.mock_forward(1)
assert "version" in no_verack_node.last_message
@@ -83,14 +80,20 @@ class TimeoutsTest(BitcoinTestFramework):
assert no_send_node.is_connected
no_verack_node.send_message(msg_ping())
- if not self.options.v2transport:
- no_version_node.send_message(msg_ping())
-
- expected_timeout_logs = [
- "version handshake timeout peer=0",
- f"socket no message in first 3 seconds, {'0' if self.options.v2transport else '1'} 0 peer=1",
- "socket no message in first 3 seconds, 0 0 peer=2",
- ]
+ no_version_node.send_message(msg_ping())
+
+ if self.options.v2transport:
+ expected_timeout_logs = [
+ "version handshake timeout peer=0",
+ "version handshake timeout peer=1",
+ "version handshake timeout peer=2",
+ ]
+ else:
+ expected_timeout_logs = [
+ "version handshake timeout peer=0",
+ "socket no message in first 3 seconds, 1 0 peer=1",
+ "socket no message in first 3 seconds, 0 0 peer=2",
+ ]
with self.nodes[0].assert_debug_log(expected_msgs=expected_timeout_logs):
self.mock_forward(2)