mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Tests: Allow specifying different cmd-line params for each masternode (#3222)
This commit is contained in:
parent
2fef21fd80
commit
5213118601
@ -39,7 +39,7 @@ class TestNode(SingleNodeConnCB):
|
|||||||
|
|
||||||
class LLMQCoinbaseCommitmentsTest(DashTestFramework):
|
class LLMQCoinbaseCommitmentsTest(DashTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
super().__init__(6, 5, fast_dip3_enforcement=True)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.test_node = TestNode()
|
self.test_node = TestNode()
|
||||||
|
@ -17,7 +17,7 @@ Checks LLMQs based ChainLocks
|
|||||||
|
|
||||||
class LLMQChainLocksTest(DashTestFramework):
|
class LLMQChainLocksTest(DashTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
super().__init__(6, 5, fast_dip3_enforcement=True)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Simulate and check DKG errors
|
|||||||
|
|
||||||
class LLMQDKGErrors(DashTestFramework):
|
class LLMQDKGErrors(DashTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
super().__init__(6, 5, fast_dip3_enforcement=True)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class TestNode(SingleNodeConnCB):
|
|||||||
|
|
||||||
class LLMQ_IS_CL_Conflicts(DashTestFramework):
|
class LLMQ_IS_CL_Conflicts(DashTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
super().__init__(6, 5, fast_dip3_enforcement=True)
|
||||||
#disable_mocktime()
|
#disable_mocktime()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
@ -17,7 +17,7 @@ Checks LLMQs signing sessions
|
|||||||
|
|
||||||
class LLMQSigningTest(DashTestFramework):
|
class LLMQSigningTest(DashTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
super().__init__(6, 5, fast_dip3_enforcement=True)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Checks simple PoSe system based on LLMQ commitments
|
|||||||
|
|
||||||
class LLMQSimplePoSeTest(DashTestFramework):
|
class LLMQSimplePoSeTest(DashTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
super().__init__(6, 5, fast_dip3_enforcement=True)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ InstantSendTest -- test InstantSend functionality (prevent doublespend for uncon
|
|||||||
|
|
||||||
class InstantSendTest(DashTestFramework):
|
class InstantSendTest(DashTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(9, 5, [], fast_dip3_enforcement=True)
|
super().__init__(9, 5, fast_dip3_enforcement=True)
|
||||||
# set sender, receiver, isolated nodes
|
# set sender, receiver, isolated nodes
|
||||||
self.isolated_idx = 1
|
self.isolated_idx = 1
|
||||||
self.receiver_idx = 2
|
self.receiver_idx = 2
|
||||||
|
@ -252,7 +252,7 @@ class MasternodeInfo:
|
|||||||
|
|
||||||
|
|
||||||
class DashTestFramework(BitcoinTestFramework):
|
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__()
|
super().__init__()
|
||||||
self.mn_count = masterodes_count
|
self.mn_count = masterodes_count
|
||||||
self.num_nodes = num_nodes
|
self.num_nodes = num_nodes
|
||||||
@ -260,17 +260,20 @@ class DashTestFramework(BitcoinTestFramework):
|
|||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.is_network_split = False
|
self.is_network_split = False
|
||||||
# additional args
|
# 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 = extra_args
|
||||||
|
|
||||||
self.extra_args += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]
|
self.extra_args[0] += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]
|
||||||
|
|
||||||
self.fast_dip3_enforcement = fast_dip3_enforcement
|
self.fast_dip3_enforcement = fast_dip3_enforcement
|
||||||
if 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):
|
def create_simple_node(self):
|
||||||
idx = len(self.nodes)
|
idx = len(self.nodes)
|
||||||
args = self.extra_args
|
args = self.extra_args[idx]
|
||||||
self.nodes.append(start_node(idx, self.options.tmpdir, args))
|
self.nodes.append(start_node(idx, self.options.tmpdir, args))
|
||||||
for i in range(0, idx):
|
for i in range(0, idx):
|
||||||
connect_nodes(self.nodes[i], idx)
|
connect_nodes(self.nodes[i], idx)
|
||||||
@ -340,7 +343,7 @@ class DashTestFramework(BitcoinTestFramework):
|
|||||||
|
|
||||||
def do_start(idx):
|
def do_start(idx):
|
||||||
args = ['-masternode=1',
|
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)
|
node = start_node(idx + start_idx, self.options.tmpdir, args)
|
||||||
self.mninfo[idx].nodeIdx = idx + start_idx
|
self.mninfo[idx].nodeIdx = idx + start_idx
|
||||||
self.mninfo[idx].node = node
|
self.mninfo[idx].node = node
|
||||||
@ -378,7 +381,7 @@ class DashTestFramework(BitcoinTestFramework):
|
|||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
# create faucet node for collateral and transactions
|
# 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
|
required_balance = MASTERNODE_COLLATERAL * self.mn_count + 1
|
||||||
while self.nodes[0].getbalance() < required_balance:
|
while self.nodes[0].getbalance() < required_balance:
|
||||||
set_mocktime(get_mocktime() + 1)
|
set_mocktime(get_mocktime() + 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user