From 52131186017062423a5a00714060eef8237bc285 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 5 Dec 2019 21:28:33 +0300 Subject: [PATCH] Tests: Allow specifying different cmd-line params for each masternode (#3222) --- qa/rpc-tests/dip4-coinbasemerkleroots.py | 2 +- qa/rpc-tests/llmq-chainlocks.py | 2 +- qa/rpc-tests/llmq-dkgerrors.py | 2 +- qa/rpc-tests/llmq-is-cl-conflicts.py | 2 +- qa/rpc-tests/llmq-signing.py | 2 +- qa/rpc-tests/llmq-simplepose.py | 2 +- qa/rpc-tests/p2p-instantsend.py | 2 +- qa/rpc-tests/test_framework/test_framework.py | 17 ++++++++++------- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/qa/rpc-tests/dip4-coinbasemerkleroots.py b/qa/rpc-tests/dip4-coinbasemerkleroots.py index 66fcf01f56a5b..e069ecbbb483c 100755 --- a/qa/rpc-tests/dip4-coinbasemerkleroots.py +++ b/qa/rpc-tests/dip4-coinbasemerkleroots.py @@ -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() diff --git a/qa/rpc-tests/llmq-chainlocks.py b/qa/rpc-tests/llmq-chainlocks.py index 4963c07542609..ede84327ef696 100755 --- a/qa/rpc-tests/llmq-chainlocks.py +++ b/qa/rpc-tests/llmq-chainlocks.py @@ -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): diff --git a/qa/rpc-tests/llmq-dkgerrors.py b/qa/rpc-tests/llmq-dkgerrors.py index 3166f47a4c01e..71c8364645a34 100755 --- a/qa/rpc-tests/llmq-dkgerrors.py +++ b/qa/rpc-tests/llmq-dkgerrors.py @@ -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): diff --git a/qa/rpc-tests/llmq-is-cl-conflicts.py b/qa/rpc-tests/llmq-is-cl-conflicts.py index 4351728e856e3..a004c6c1ca04b 100755 --- a/qa/rpc-tests/llmq-is-cl-conflicts.py +++ b/qa/rpc-tests/llmq-is-cl-conflicts.py @@ -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): diff --git a/qa/rpc-tests/llmq-signing.py b/qa/rpc-tests/llmq-signing.py index 02e9637988b1e..11740e4322f63 100755 --- a/qa/rpc-tests/llmq-signing.py +++ b/qa/rpc-tests/llmq-signing.py @@ -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): diff --git a/qa/rpc-tests/llmq-simplepose.py b/qa/rpc-tests/llmq-simplepose.py index 93f00514c9634..97ca90353d5c7 100755 --- a/qa/rpc-tests/llmq-simplepose.py +++ b/qa/rpc-tests/llmq-simplepose.py @@ -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): diff --git a/qa/rpc-tests/p2p-instantsend.py b/qa/rpc-tests/p2p-instantsend.py index 88f9bd0b02a29..f74b4ddae8c36 100755 --- a/qa/rpc-tests/p2p-instantsend.py +++ b/qa/rpc-tests/p2p-instantsend.py @@ -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 diff --git a/qa/rpc-tests/test_framework/test_framework.py b/qa/rpc-tests/test_framework/test_framework.py index 9b0d6a275e18e..1043d986819c7 100755 --- a/qa/rpc-tests/test_framework/test_framework.py +++ b/qa/rpc-tests/test_framework/test_framework.py @@ -252,7 +252,7 @@ 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 @@ -260,17 +260,20 @@ def __init__(self, num_nodes, masterodes_count, extra_args, fast_dip3_enforcemen 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) @@ -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 @@ -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)