Skip to content

Commit fad676b

Browse files
author
MarcoFalke
committed
test: Add connect_nodes method
1 parent fac6ef4 commit fad676b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ def setup_network(self):
353353
# See fPreferredDownload in net_processing.
354354
#
355355
# If further outbound connections are needed, they can be added at the beginning of the test with e.g.
356-
# connect_nodes(self.nodes[1], 2)
356+
# self.connect_nodes(1, 2)
357357
for i in range(self.num_nodes - 1):
358-
connect_nodes(self.nodes[i + 1], i)
358+
self.connect_nodes(i + 1, i)
359359
self.sync_all()
360360

361361
def setup_nodes(self):
@@ -532,19 +532,25 @@ def restart_node(self, i, extra_args=None):
532532
def wait_for_node_exit(self, i, timeout):
533533
self.nodes[i].process.wait(timeout)
534534

535+
def connect_nodes(self, a, b):
536+
connect_nodes(self.nodes[a], b)
537+
538+
def disconnect_nodes(self, a, b):
539+
disconnect_nodes(self.nodes[a], b)
540+
535541
def split_network(self):
536542
"""
537543
Split the network of four nodes into nodes 0/1 and 2/3.
538544
"""
539-
disconnect_nodes(self.nodes[1], 2)
545+
self.disconnect_nodes(1, 2)
540546
self.sync_all(self.nodes[:2])
541547
self.sync_all(self.nodes[2:])
542548

543549
def join_network(self):
544550
"""
545551
Join the (previously split) network halves together.
546552
"""
547-
connect_nodes(self.nodes[1], 2)
553+
self.connect_nodes(1, 2)
548554
self.sync_all()
549555

550556
def sync_blocks(self, nodes=None, wait=1, timeout=60):

0 commit comments

Comments
 (0)