Skip to content

Commit

Permalink
Tests: Allow specifying different cmd-line params for each masternode (
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 authored and codablock committed Dec 6, 2019
1 parent 2fef21f commit 5213118
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion qa/rpc-tests/dip4-coinbasemerkleroots.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def getmnlistdiff(self, baseBlockHash, blockHash):

class LLMQCoinbaseCommitmentsTest(DashTestFramework):
def __init__(self):
super().__init__(6, 5, [], fast_dip3_enforcement=True)
super().__init__(6, 5, fast_dip3_enforcement=True)

def run_test(self):
self.test_node = TestNode()
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/llmq-chainlocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class LLMQChainLocksTest(DashTestFramework):
def __init__(self):
super().__init__(6, 5, [], fast_dip3_enforcement=True)
super().__init__(6, 5, fast_dip3_enforcement=True)

def run_test(self):

Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/llmq-dkgerrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class LLMQDKGErrors(DashTestFramework):
def __init__(self):
super().__init__(6, 5, [], fast_dip3_enforcement=True)
super().__init__(6, 5, fast_dip3_enforcement=True)

def run_test(self):

Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/llmq-is-cl-conflicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def on_getdata(self, conn, message):

class LLMQ_IS_CL_Conflicts(DashTestFramework):
def __init__(self):
super().__init__(6, 5, [], fast_dip3_enforcement=True)
super().__init__(6, 5, fast_dip3_enforcement=True)
#disable_mocktime()

def run_test(self):
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/llmq-signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class LLMQSigningTest(DashTestFramework):
def __init__(self):
super().__init__(6, 5, [], fast_dip3_enforcement=True)
super().__init__(6, 5, fast_dip3_enforcement=True)

def run_test(self):

Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/llmq-simplepose.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class LLMQSimplePoSeTest(DashTestFramework):
def __init__(self):
super().__init__(6, 5, [], fast_dip3_enforcement=True)
super().__init__(6, 5, fast_dip3_enforcement=True)

def run_test(self):

Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/p2p-instantsend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class InstantSendTest(DashTestFramework):
def __init__(self):
super().__init__(9, 5, [], fast_dip3_enforcement=True)
super().__init__(9, 5, fast_dip3_enforcement=True)
# set sender, receiver, isolated nodes
self.isolated_idx = 1
self.receiver_idx = 2
Expand Down
17 changes: 10 additions & 7 deletions qa/rpc-tests/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,25 +252,28 @@ def __init__(self, proTxHash, ownerAddr, votingAddr, pubKeyOperator, keyOperator


class DashTestFramework(BitcoinTestFramework):
def __init__(self, num_nodes, masterodes_count, extra_args, fast_dip3_enforcement=False):
def __init__(self, num_nodes, masterodes_count, extra_args=None, fast_dip3_enforcement=False):
super().__init__()
self.mn_count = masterodes_count
self.num_nodes = num_nodes
self.mninfo = []
self.setup_clean_chain = True
self.is_network_split = False
# additional args
if extra_args is None:
extra_args = [[]] * num_nodes
assert_equal(len(extra_args), num_nodes)
self.extra_args = extra_args

self.extra_args += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]

self.extra_args[0] += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]
self.fast_dip3_enforcement = fast_dip3_enforcement
if fast_dip3_enforcement:
self.extra_args += ["-dip3params=30:50"]
for i in range(0, num_nodes):
self.extra_args[i] += ["-dip3params=30:50"]

def create_simple_node(self):
idx = len(self.nodes)
args = self.extra_args
args = self.extra_args[idx]
self.nodes.append(start_node(idx, self.options.tmpdir, args))
for i in range(0, idx):
connect_nodes(self.nodes[i], idx)
Expand Down Expand Up @@ -340,7 +343,7 @@ def start_masternodes(self):

def do_start(idx):
args = ['-masternode=1',
'-masternodeblsprivkey=%s' % self.mninfo[idx].keyOperator] + self.extra_args
'-masternodeblsprivkey=%s' % self.mninfo[idx].keyOperator] + self.extra_args[idx + start_idx]
node = start_node(idx + start_idx, self.options.tmpdir, args)
self.mninfo[idx].nodeIdx = idx + start_idx
self.mninfo[idx].node = node
Expand Down Expand Up @@ -378,7 +381,7 @@ def do_connect(idx):
def setup_network(self):
self.nodes = []
# create faucet node for collateral and transactions
self.nodes.append(start_node(0, self.options.tmpdir, self.extra_args))
self.nodes.append(start_node(0, self.options.tmpdir, self.extra_args[0]))
required_balance = MASTERNODE_COLLATERAL * self.mn_count + 1
while self.nodes[0].getbalance() < required_balance:
set_mocktime(get_mocktime() + 1)
Expand Down

0 comments on commit 5213118

Please sign in to comment.