mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-26 05:48:20 +01:00
test: persist -v2transport over restarts and respect -v2transport=0
Before, a global -v2transport provided to the test would be dropped when restarting the node within a test and specifying any extra_args. Fix this by adding "v2transport=1" to args (not extra_args) based on the global parameter, and deciding for each (re)start of the node based on this default and test-specific extra_args (which take precedence over args) whether v2 should be used.
This commit is contained in:
@@ -508,8 +508,6 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
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),
|
||||
@@ -528,6 +526,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
start_perf=self.options.perf,
|
||||
use_valgrind=self.options.valgrind,
|
||||
descriptors=self.options.descriptors,
|
||||
v2transport=self.options.v2transport,
|
||||
)
|
||||
self.nodes.append(test_node_i)
|
||||
if not test_node_i.version_is_at_least(170000):
|
||||
@@ -602,7 +601,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
ip_port = "127.0.0.1:" + str(p2p_port(b))
|
||||
|
||||
if peer_advertises_v2 is None:
|
||||
peer_advertises_v2 = self.options.v2transport
|
||||
peer_advertises_v2 = from_connection.use_v2transport
|
||||
|
||||
if peer_advertises_v2:
|
||||
from_connection.addnode(node=ip_port, command="onetry", v2transport=True)
|
||||
|
||||
Reference in New Issue
Block a user