Skip to content

Commit 64ca721

Browse files
committed
test: enable v2 transport between nodes in some functional tests
1 parent 05d19fb commit 64ca721

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ def parse_args(self):
189189
parser.add_argument("--randomseed", type=int,
190190
help="set a random seed for deterministically reproducing a previous test run")
191191
parser.add_argument("--timeout-factor", dest="timeout_factor", type=float, help="adjust test timeouts by a factor. Setting it to 0 disables all timeouts")
192+
parser.add_argument("--v2transport", dest="v2transport", default=False, action="store_true",
193+
help="use BIP324 v2 connections between all nodes by default")
192194

193195
self.add_options(parser)
194196
# Running TestShell in a Jupyter notebook causes an additional -f argument
@@ -504,6 +506,9 @@ def get_bin_from_version(version, bin_name, bin_default):
504506
assert_equal(len(binary), num_nodes)
505507
assert_equal(len(binary_cli), num_nodes)
506508
for i in range(num_nodes):
509+
args = list(extra_args[i])
510+
if self.options.v2transport and ("-v2transport=0" not in args):
511+
args.append("-v2transport=1")
507512
test_node_i = TestNode(
508513
i,
509514
get_datadir_path(self.options.tmpdir, i),
@@ -517,7 +522,7 @@ def get_bin_from_version(version, bin_name, bin_default):
517522
coverage_dir=self.options.coveragedir,
518523
cwd=self.options.tmpdir,
519524
extra_conf=extra_confs[i],
520-
extra_args=extra_args[i],
525+
extra_args=args,
521526
use_cli=self.options.usecli,
522527
start_perf=self.options.perf,
523528
use_valgrind=self.options.valgrind,
@@ -581,13 +586,16 @@ def restart_node(self, i, extra_args=None):
581586
def wait_for_node_exit(self, i, timeout):
582587
self.nodes[i].process.wait(timeout)
583588

584-
def connect_nodes(self, a, b, *, peer_advertises_v2=False):
589+
def connect_nodes(self, a, b, *, peer_advertises_v2=None):
585590
from_connection = self.nodes[a]
586591
to_connection = self.nodes[b]
587592
from_num_peers = 1 + len(from_connection.getpeerinfo())
588593
to_num_peers = 1 + len(to_connection.getpeerinfo())
589594
ip_port = "127.0.0.1:" + str(p2p_port(b))
590595

596+
if peer_advertises_v2 is None:
597+
peer_advertises_v2 = self.options.v2transport
598+
591599
if peer_advertises_v2:
592600
from_connection.addnode(node=ip_port, command="onetry", v2transport=True)
593601
else:

test/functional/test_runner.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
'wallet_backup.py --descriptors',
118118
'feature_segwit.py --legacy-wallet',
119119
'feature_segwit.py --descriptors',
120+
'feature_segwit.py --descriptors --v2transport',
120121
'p2p_tx_download.py',
121122
'wallet_avoidreuse.py --legacy-wallet',
122123
'wallet_avoidreuse.py --descriptors',
@@ -195,6 +196,7 @@
195196
'wallet_avoid_mixing_output_types.py --descriptors',
196197
'mempool_reorg.py',
197198
'p2p_block_sync.py',
199+
'p2p_block_sync.py --v2transport',
198200
'wallet_createwallet.py --legacy-wallet',
199201
'wallet_createwallet.py --usecli',
200202
'wallet_createwallet.py --descriptors',
@@ -221,10 +223,13 @@
221223
'wallet_transactiontime_rescan.py --legacy-wallet',
222224
'p2p_addrv2_relay.py',
223225
'p2p_compactblocks_hb.py',
226+
'p2p_compactblocks_hb.py --v2transport',
224227
'p2p_disconnect_ban.py',
228+
'p2p_disconnect_ban.py --v2transport',
225229
'feature_posix_fs_permissions.py',
226230
'rpc_decodescript.py',
227231
'rpc_blockchain.py',
232+
'rpc_blockchain.py --v2transport',
228233
'rpc_deprecated.py',
229234
'wallet_disable.py',
230235
'wallet_change_address.py --legacy-wallet',
@@ -245,7 +250,9 @@
245250
'mining_prioritisetransaction.py',
246251
'p2p_invalid_locator.py',
247252
'p2p_invalid_block.py',
253+
'p2p_invalid_block.py --v2transport',
248254
'p2p_invalid_tx.py',
255+
'p2p_invalid_tx.py --v2transport',
249256
'p2p_v2_transport.py',
250257
'example_test.py',
251258
'wallet_txn_doublespend.py --legacy-wallet',
@@ -268,9 +275,12 @@
268275
'wallet_importprunedfunds.py --legacy-wallet',
269276
'wallet_importprunedfunds.py --descriptors',
270277
'p2p_leak_tx.py',
278+
'p2p_leak_tx.py --v2transport',
271279
'p2p_eviction.py',
272280
'p2p_ibd_stalling.py',
281+
'p2p_ibd_stalling.py --v2transport',
273282
'p2p_net_deadlock.py',
283+
'p2p_net_deadlock.py --v2transport',
274284
'wallet_signmessagewithaddress.py',
275285
'rpc_signmessagewithprivkey.py',
276286
'rpc_generate.py',

0 commit comments

Comments
 (0)