Skip to content

Commit 8ba042b

Browse files
committed
Fix dip3-deterministicmns.py
1 parent f51a4df commit 8ba042b

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

test/functional/dip3-deterministicmns.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class Masternode(object):
1717
pass
1818

1919
class DIP3Test(BitcoinTestFramework):
20-
def __init__(self):
21-
super().__init__()
20+
def set_test_params(self):
2221
self.num_initial_mn = 11 # Should be >= 11 to make sure quorums are not always the same MNs
2322
self.num_nodes = 1 + self.num_initial_mn + 2 # +1 for controller, +1 for mn-qt, +1 for mn created after dip3 activation
2423
self.setup_clean_chain = True
@@ -30,18 +29,14 @@ def __init__(self):
3029

3130
def setup_network(self):
3231
self.disable_mocktime()
32+
self.add_nodes(1)
3333
self.start_controller_node()
3434

35-
def start_controller_node(self, extra_args=None):
35+
def start_controller_node(self):
3636
self.log.info("starting controller node")
37-
if len(self.nodes) == 0:
38-
self.nodes.append(None)
39-
args = self.extra_args
40-
if extra_args is not None:
41-
args += extra_args
42-
self.nodes[0] = self.start_node(0, self.options.tmpdir, extra_args=args)
37+
self.start_node(0, extra_args=self.extra_args)
4338
for i in range(1, self.num_nodes):
44-
if i < len(self.nodes) and self.nodes[i] is not None:
39+
if i < len(self.nodes) and self.nodes[i] is not None and self.nodes[i].process is not None:
4540
connect_nodes_bi(self.nodes, 0, i)
4641

4742
def stop_controller_node(self):
@@ -245,12 +240,11 @@ def register_mn(self, node, mn):
245240

246241
def start_mn(self, mn):
247242
while len(self.nodes) <= mn.idx:
248-
self.nodes.append(None)
243+
self.add_nodes(1)
249244
extra_args = ['-masternode=1', '-masternodeblsprivkey=%s' % mn.blsMnkey]
250-
n = self.start_node(mn.idx, self.options.tmpdir, self.extra_args + extra_args, stderr=sys.stdout)
251-
self.nodes[mn.idx] = n
252-
for i in range(0, self.num_nodes):
253-
if i < len(self.nodes) and self.nodes[i] is not None and i != mn.idx:
245+
self.start_node(mn.idx, extra_args = self.extra_args + extra_args, stderr=sys.stdout)
246+
for i in range(0, len(self.nodes)):
247+
if i < len(self.nodes) and self.nodes[i] is not None and self.nodes[i].process is not None and i != mn.idx:
254248
connect_nodes_bi(self.nodes, mn.idx, i)
255249
mn.node = self.nodes[mn.idx]
256250
self.sync_all()

0 commit comments

Comments
 (0)