Skip to content

Commit

Permalink
test: Add connect_nodes method
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Jun 21, 2020
1 parent fac6ef4 commit fad676b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ def setup_network(self):
# See fPreferredDownload in net_processing.
#
# If further outbound connections are needed, they can be added at the beginning of the test with e.g.
# connect_nodes(self.nodes[1], 2)
# self.connect_nodes(1, 2)
for i in range(self.num_nodes - 1):
connect_nodes(self.nodes[i + 1], i)
self.connect_nodes(i + 1, i)
self.sync_all()

def setup_nodes(self):
Expand Down Expand Up @@ -532,19 +532,25 @@ 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):
connect_nodes(self.nodes[a], b)

def disconnect_nodes(self, a, b):
disconnect_nodes(self.nodes[a], b)

def split_network(self):
"""
Split the network of four nodes into nodes 0/1 and 2/3.
"""
disconnect_nodes(self.nodes[1], 2)
self.disconnect_nodes(1, 2)
self.sync_all(self.nodes[:2])
self.sync_all(self.nodes[2:])

def join_network(self):
"""
Join the (previously split) network halves together.
"""
connect_nodes(self.nodes[1], 2)
self.connect_nodes(1, 2)
self.sync_all()

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

0 comments on commit fad676b

Please sign in to comment.