aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_net.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/rpc_net.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/rpc_net.py')
-rwxr-xr-xtest/functional/rpc_net.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index afb75ab208..b4a58df5b2 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -117,6 +117,9 @@ class NetTest(BitcoinTestFramework):
peer_info = self.nodes[0].getpeerinfo()[no_version_peer_id]
peer_info.pop("addr")
peer_info.pop("addrbind")
+ # The next two fields will vary for v2 connections because we send a rng-based number of decoy messages
+ peer_info.pop("bytesrecv")
+ peer_info.pop("bytessent")
assert_equal(
peer_info,
{
@@ -125,9 +128,7 @@ class NetTest(BitcoinTestFramework):
"addr_relay_enabled": False,
"bip152_hb_from": False,
"bip152_hb_to": False,
- "bytesrecv": 0,
"bytesrecv_per_msg": {},
- "bytessent": 0,
"bytessent_per_msg": {},
"connection_type": "inbound",
"conntime": no_version_peer_conntime,
@@ -136,8 +137,8 @@ class NetTest(BitcoinTestFramework):
"inflight": [],
"last_block": 0,
"last_transaction": 0,
- "lastrecv": 0,
- "lastsend": 0,
+ "lastrecv": 0 if not self.options.v2transport else no_version_peer_conntime,
+ "lastsend": 0 if not self.options.v2transport else no_version_peer_conntime,
"minfeefilter": Decimal("0E-8"),
"network": "not_publicly_routable",
"permissions": [],
@@ -145,13 +146,13 @@ class NetTest(BitcoinTestFramework):
"relaytxes": False,
"services": "0000000000000000",
"servicesnames": [],
- "session_id": "",
+ "session_id": "" if not self.options.v2transport else no_version_peer.v2_state.peer['session_id'].hex(),
"startingheight": -1,
"subver": "",
"synced_blocks": -1,
"synced_headers": -1,
"timeoffset": 0,
- "transport_protocol_type": "v1" if not self.options.v2transport else "detecting",
+ "transport_protocol_type": "v1" if not self.options.v2transport else "v2",
"version": 0,
},
)