mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Fix DashTestFramework and tests depending on it
This commit is contained in:
parent
ac0f483d85
commit
a304d4d47c
@ -37,8 +37,8 @@ class TestNode(NodeConnCB):
|
||||
|
||||
|
||||
class LLMQCoinbaseCommitmentsTest(DashTestFramework):
|
||||
def __init__(self):
|
||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
||||
def set_test_params(self):
|
||||
self.set_dash_test_params(6, 5, [], fast_dip3_enforcement=True)
|
||||
|
||||
def run_test(self):
|
||||
self.test_node = TestNode()
|
||||
|
@ -17,8 +17,8 @@ Checks LLMQs based ChainLocks
|
||||
'''
|
||||
|
||||
class LLMQChainLocksTest(DashTestFramework):
|
||||
def __init__(self):
|
||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
||||
def set_test_params(self):
|
||||
self.set_dash_test_params(6, 5, [], fast_dip3_enforcement=True)
|
||||
|
||||
def run_test(self):
|
||||
|
||||
|
@ -14,8 +14,8 @@ Simulate and check DKG errors
|
||||
'''
|
||||
|
||||
class LLMQDKGErrors(DashTestFramework):
|
||||
def __init__(self):
|
||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
||||
def set_test_params(self):
|
||||
self.set_dash_test_params(6, 5, [], fast_dip3_enforcement=True)
|
||||
|
||||
def run_test(self):
|
||||
|
||||
|
@ -45,8 +45,8 @@ class TestNode(NodeConnCB):
|
||||
|
||||
|
||||
class LLMQ_IS_CL_Conflicts(DashTestFramework):
|
||||
def __init__(self):
|
||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
||||
def set_test_params(self):
|
||||
self.set_dash_test_params(6, 5, [], fast_dip3_enforcement=True)
|
||||
#disable_mocktime()
|
||||
|
||||
def run_test(self):
|
||||
|
@ -17,8 +17,8 @@ Checks LLMQs signing sessions
|
||||
'''
|
||||
|
||||
class LLMQSigningTest(DashTestFramework):
|
||||
def __init__(self):
|
||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
||||
def set_test_params(self):
|
||||
self.set_dash_test_params(6, 5, [], fast_dip3_enforcement=True)
|
||||
|
||||
def run_test(self):
|
||||
|
||||
|
@ -16,8 +16,8 @@ Checks simple PoSe system based on LLMQ commitments
|
||||
'''
|
||||
|
||||
class LLMQSimplePoSeTest(DashTestFramework):
|
||||
def __init__(self):
|
||||
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
||||
def set_test_params(self):
|
||||
self.set_dash_test_params(6, 5, [], fast_dip3_enforcement=True)
|
||||
|
||||
def run_test(self):
|
||||
|
||||
|
@ -12,8 +12,8 @@ InstantSendTest -- test InstantSend functionality (prevent doublespend for uncon
|
||||
'''
|
||||
|
||||
class InstantSendTest(DashTestFramework):
|
||||
def __init__(self):
|
||||
super().__init__(9, 5, [], fast_dip3_enforcement=True)
|
||||
def set_test_params(self):
|
||||
self.set_dash_test_params(9, 5, [], fast_dip3_enforcement=True)
|
||||
# set sender, receiver, isolated nodes
|
||||
self.isolated_idx = 1
|
||||
self.receiver_idx = 2
|
||||
|
@ -482,8 +482,7 @@ class MasternodeInfo:
|
||||
|
||||
|
||||
class DashTestFramework(BitcoinTestFramework):
|
||||
def __init__(self, num_nodes, masterodes_count, extra_args, fast_dip3_enforcement=False):
|
||||
super().__init__()
|
||||
def set_dash_test_params(self, num_nodes, masterodes_count, extra_args, fast_dip3_enforcement=False):
|
||||
self.mn_count = masterodes_count
|
||||
self.num_nodes = num_nodes
|
||||
self.mninfo = []
|
||||
@ -500,8 +499,8 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
|
||||
def create_simple_node(self):
|
||||
idx = len(self.nodes)
|
||||
args = self.extra_args
|
||||
self.nodes.append(self.start_node(idx, self.options.tmpdir, args))
|
||||
self.add_nodes(1, extra_args=[self.extra_args])
|
||||
self.start_node(idx)
|
||||
for i in range(0, idx):
|
||||
connect_nodes(self.nodes[i], idx)
|
||||
|
||||
@ -559,23 +558,21 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
copy_datadir(0, idx + start_idx, self.options.tmpdir)
|
||||
|
||||
# restart faucet node
|
||||
self.nodes[0] = self.start_node(0, self.options.tmpdir, self.extra_args)
|
||||
self.start_node(0)
|
||||
|
||||
def start_masternodes(self):
|
||||
start_idx = len(self.nodes)
|
||||
|
||||
for idx in range(0, self.mn_count):
|
||||
self.nodes.append(None)
|
||||
self.add_nodes(self.mn_count)
|
||||
executor = ThreadPoolExecutor(max_workers=20)
|
||||
|
||||
def do_start(idx):
|
||||
args = ['-masternode=1',
|
||||
'-masternodeblsprivkey=%s' % self.mninfo[idx].keyOperator] + self.extra_args
|
||||
node = self.start_node(idx + start_idx, self.options.tmpdir, args)
|
||||
self.start_node(idx + start_idx, extra_args=args)
|
||||
self.mninfo[idx].nodeIdx = idx + start_idx
|
||||
self.mninfo[idx].node = node
|
||||
self.nodes[idx + start_idx] = node
|
||||
wait_to_sync(node, True)
|
||||
self.mninfo[idx].node = self.nodes[idx + start_idx]
|
||||
wait_to_sync(self.mninfo[idx].node, True)
|
||||
|
||||
def do_connect(idx):
|
||||
for i in range(0, idx + 1):
|
||||
@ -606,9 +603,9 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
executor.shutdown()
|
||||
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
# create faucet node for collateral and transactions
|
||||
self.nodes.append(self.start_node(0, self.options.tmpdir, self.extra_args))
|
||||
self.add_nodes(1, extra_args=[self.extra_args])
|
||||
self.start_node(0)
|
||||
required_balance = MASTERNODE_COLLATERAL * self.mn_count + 1
|
||||
while self.nodes[0].getbalance() < required_balance:
|
||||
self.bump_mocktime(1)
|
||||
|
Loading…
Reference in New Issue
Block a user