Skip to content

Commit

Permalink
test: enable v2 transport between nodes in some functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Oct 2, 2023
1 parent 05d19fb commit 64ca721
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/functional/test_framework/test_framework.py
Expand Up @@ -189,6 +189,8 @@ def parse_args(self):
parser.add_argument("--randomseed", type=int,
help="set a random seed for deterministically reproducing a previous test run")
parser.add_argument("--timeout-factor", dest="timeout_factor", type=float, help="adjust test timeouts by a factor. Setting it to 0 disables all timeouts")
parser.add_argument("--v2transport", dest="v2transport", default=False, action="store_true",
help="use BIP324 v2 connections between all nodes by default")

self.add_options(parser)
# Running TestShell in a Jupyter notebook causes an additional -f argument
Expand Down Expand Up @@ -504,6 +506,9 @@ def get_bin_from_version(version, bin_name, bin_default):
assert_equal(len(binary), num_nodes)
assert_equal(len(binary_cli), num_nodes)
for i in range(num_nodes):
args = list(extra_args[i])
if self.options.v2transport and ("-v2transport=0" not in args):
args.append("-v2transport=1")
test_node_i = TestNode(
i,
get_datadir_path(self.options.tmpdir, i),
Expand All @@ -517,7 +522,7 @@ def get_bin_from_version(version, bin_name, bin_default):
coverage_dir=self.options.coveragedir,
cwd=self.options.tmpdir,
extra_conf=extra_confs[i],
extra_args=extra_args[i],
extra_args=args,
use_cli=self.options.usecli,
start_perf=self.options.perf,
use_valgrind=self.options.valgrind,
Expand Down Expand Up @@ -581,13 +586,16 @@ def restart_node(self, i, extra_args=None):
def wait_for_node_exit(self, i, timeout):
self.nodes[i].process.wait(timeout)

def connect_nodes(self, a, b, *, peer_advertises_v2=False):
def connect_nodes(self, a, b, *, peer_advertises_v2=None):
from_connection = self.nodes[a]
to_connection = self.nodes[b]
from_num_peers = 1 + len(from_connection.getpeerinfo())
to_num_peers = 1 + len(to_connection.getpeerinfo())
ip_port = "127.0.0.1:" + str(p2p_port(b))

if peer_advertises_v2 is None:
peer_advertises_v2 = self.options.v2transport

if peer_advertises_v2:
from_connection.addnode(node=ip_port, command="onetry", v2transport=True)
else:
Expand Down
10 changes: 10 additions & 0 deletions test/functional/test_runner.py
Expand Up @@ -117,6 +117,7 @@
'wallet_backup.py --descriptors',
'feature_segwit.py --legacy-wallet',
'feature_segwit.py --descriptors',
'feature_segwit.py --descriptors --v2transport',
'p2p_tx_download.py',
'wallet_avoidreuse.py --legacy-wallet',
'wallet_avoidreuse.py --descriptors',
Expand Down Expand Up @@ -195,6 +196,7 @@
'wallet_avoid_mixing_output_types.py --descriptors',
'mempool_reorg.py',
'p2p_block_sync.py',
'p2p_block_sync.py --v2transport',
'wallet_createwallet.py --legacy-wallet',
'wallet_createwallet.py --usecli',
'wallet_createwallet.py --descriptors',
Expand All @@ -221,10 +223,13 @@
'wallet_transactiontime_rescan.py --legacy-wallet',
'p2p_addrv2_relay.py',
'p2p_compactblocks_hb.py',
'p2p_compactblocks_hb.py --v2transport',
'p2p_disconnect_ban.py',
'p2p_disconnect_ban.py --v2transport',
'feature_posix_fs_permissions.py',
'rpc_decodescript.py',
'rpc_blockchain.py',
'rpc_blockchain.py --v2transport',
'rpc_deprecated.py',
'wallet_disable.py',
'wallet_change_address.py --legacy-wallet',
Expand All @@ -245,7 +250,9 @@
'mining_prioritisetransaction.py',
'p2p_invalid_locator.py',
'p2p_invalid_block.py',
'p2p_invalid_block.py --v2transport',
'p2p_invalid_tx.py',
'p2p_invalid_tx.py --v2transport',
'p2p_v2_transport.py',
'example_test.py',
'wallet_txn_doublespend.py --legacy-wallet',
Expand All @@ -268,9 +275,12 @@
'wallet_importprunedfunds.py --legacy-wallet',
'wallet_importprunedfunds.py --descriptors',
'p2p_leak_tx.py',
'p2p_leak_tx.py --v2transport',
'p2p_eviction.py',
'p2p_ibd_stalling.py',
'p2p_ibd_stalling.py --v2transport',
'p2p_net_deadlock.py',
'p2p_net_deadlock.py --v2transport',
'wallet_signmessagewithaddress.py',
'rpc_signmessagewithprivkey.py',
'rpc_generate.py',
Expand Down

0 comments on commit 64ca721

Please sign in to comment.