mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
tests: Let mine_quorum handle expected connections count based on spork21 state (#3832)
This commit is contained in:
parent
b2cc7a8c96
commit
071ec6c4fc
@ -22,7 +22,7 @@ class LLMQConnections(DashTestFramework):
|
||||
self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
||||
self.wait_for_sporks_same()
|
||||
|
||||
q = self.mine_quorum(expected_connections=2)
|
||||
q = self.mine_quorum()
|
||||
|
||||
self.log.info("checking for old intra quorum connections")
|
||||
total_count = 0
|
||||
@ -44,7 +44,7 @@ class LLMQConnections(DashTestFramework):
|
||||
self.wait_for_mnauth(mn.node, 4)
|
||||
|
||||
self.log.info("mine a new quorum and verify that all members connect to each other")
|
||||
q = self.mine_quorum(expected_connections=4)
|
||||
q = self.mine_quorum()
|
||||
|
||||
self.log.info("checking that all MNs got probed")
|
||||
for mn in self.get_quorum_masternodes(q):
|
||||
@ -56,7 +56,7 @@ class LLMQConnections(DashTestFramework):
|
||||
wait_until(lambda: self.get_mn_probe_count(mn.node, q, False) == 0)
|
||||
|
||||
self.log.info("mine a new quorum and re-check probes")
|
||||
q = self.mine_quorum(expected_connections=4)
|
||||
q = self.mine_quorum()
|
||||
for mn in self.get_quorum_masternodes(q):
|
||||
wait_until(lambda: self.get_mn_probe_count(mn.node, q, True) == 4)
|
||||
|
||||
|
@ -26,13 +26,11 @@ class LLMQSigningTest(DashTestFramework):
|
||||
def run_test(self):
|
||||
|
||||
self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
||||
expected_connections = 2
|
||||
if self.options.spork21:
|
||||
self.nodes[0].spork("SPORK_21_QUORUM_ALL_CONNECTED", 0)
|
||||
expected_connections = 4
|
||||
self.wait_for_sporks_same()
|
||||
|
||||
self.mine_quorum(expected_connections=expected_connections)
|
||||
self.mine_quorum()
|
||||
|
||||
id = "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
msgHash = "0000000000000000000000000000000000000000000000000000000000000002"
|
||||
@ -69,12 +67,12 @@ class LLMQSigningTest(DashTestFramework):
|
||||
recsig_time = self.mocktime
|
||||
|
||||
# Mine one more quorum, so that we have 2 active ones, nothing should change
|
||||
self.mine_quorum(expected_connections=expected_connections)
|
||||
self.mine_quorum()
|
||||
assert_sigs_nochange(True, False, True, 3)
|
||||
|
||||
# Mine 2 more quorums, so that the one used for the the recovered sig should become inactive, nothing should change
|
||||
self.mine_quorum(expected_connections=expected_connections)
|
||||
self.mine_quorum(expected_connections=expected_connections)
|
||||
self.mine_quorum()
|
||||
self.mine_quorum()
|
||||
assert_sigs_nochange(True, False, True, 3)
|
||||
|
||||
# fast forward until 0.5 days before cleanup is expected, recovered sig should still be valid
|
||||
|
@ -26,7 +26,7 @@ class LLMQSimplePoSeTest(DashTestFramework):
|
||||
self.wait_for_sporks_same()
|
||||
|
||||
# check if mining quorums with all nodes being online succeeds without punishment/banning
|
||||
self.test_no_banning(expected_connections=2)
|
||||
self.test_no_banning()
|
||||
|
||||
# Now lets isolate MNs one by one and verify that punishment/banning happens
|
||||
self.test_banning(self.isolate_mn, 1)
|
||||
@ -39,7 +39,7 @@ class LLMQSimplePoSeTest(DashTestFramework):
|
||||
self.reset_probe_timeouts()
|
||||
|
||||
# Make sure no banning happens with spork21 enabled
|
||||
self.test_no_banning(expected_connections=4)
|
||||
self.test_no_banning()
|
||||
|
||||
# Lets restart masternodes with closed ports and verify that they get banned even though they are connected to other MNs (via outbound connections)
|
||||
self.test_banning(self.close_mn_port, 3)
|
||||
@ -72,9 +72,9 @@ class LLMQSimplePoSeTest(DashTestFramework):
|
||||
self.reset_probe_timeouts()
|
||||
return False
|
||||
|
||||
def test_no_banning(self, expected_connections):
|
||||
def test_no_banning(self):
|
||||
for i in range(3):
|
||||
self.mine_quorum(expected_connections=expected_connections)
|
||||
self.mine_quorum()
|
||||
for mn in self.mninfo:
|
||||
assert(not self.check_punished(mn) and not self.check_banned(mn))
|
||||
|
||||
|
@ -899,7 +899,11 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
return all_ok
|
||||
wait_until(check_dkg_comitments, timeout=timeout, sleep=0.1)
|
||||
|
||||
def mine_quorum(self, expected_connections=2, expected_members=None, expected_contributions=None, expected_complaints=0, expected_justifications=0, expected_commitments=None, mninfos_online=None, mninfos_valid=None):
|
||||
def mine_quorum(self, expected_connections=None, expected_members=None, expected_contributions=None, expected_complaints=0, expected_justifications=0, expected_commitments=None, mninfos_online=None, mninfos_valid=None):
|
||||
spork21_active = self.nodes[0].spork('show')['SPORK_21_QUORUM_ALL_CONNECTED'] <= 1
|
||||
|
||||
if expected_connections is None:
|
||||
expected_connections = (self.llmq_size - 1) if spork21_active else 2
|
||||
if expected_members is None:
|
||||
expected_members = self.llmq_size
|
||||
if expected_contributions is None:
|
||||
@ -931,7 +935,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
self.log.info("Waiting for phase 1 (init)")
|
||||
self.wait_for_quorum_phase(q, 1, expected_members, None, 0, mninfos_online)
|
||||
self.wait_for_quorum_connections(expected_connections, nodes, wait_proc=lambda: self.bump_mocktime(1, nodes=nodes))
|
||||
if self.nodes[0].spork('show')['SPORK_21_QUORUM_ALL_CONNECTED'] == 0:
|
||||
if spork21_active:
|
||||
self.wait_for_masternode_probes(mninfos_valid, wait_proc=lambda: self.bump_mocktime(1, nodes=nodes))
|
||||
self.bump_mocktime(1, nodes=nodes)
|
||||
self.nodes[0].generate(2)
|
||||
|
Loading…
Reference in New Issue
Block a user