mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: make expected_connections optional
This commit is contained in:
parent
fd2fbe06a3
commit
cedd3d52be
@ -45,7 +45,7 @@ class LLMQSimplePoSeTest(DashTestFramework):
|
||||
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)
|
||||
self.test_banning(self.close_mn_port)
|
||||
self.deaf_mns.clear()
|
||||
|
||||
self.repair_masternodes(True)
|
||||
@ -158,7 +158,7 @@ class LLMQSimplePoSeTest(DashTestFramework):
|
||||
|
||||
return new_quorum
|
||||
|
||||
def test_banning(self, invalidate_proc, expected_connections):
|
||||
def test_banning(self, invalidate_proc, expected_connections=None):
|
||||
mninfos_online = self.mninfo.copy()
|
||||
mninfos_valid = self.mninfo.copy()
|
||||
expected_contributors = len(mninfos_online)
|
||||
@ -173,11 +173,13 @@ class LLMQSimplePoSeTest(DashTestFramework):
|
||||
# NOTE: Min PoSe penalty is 100 (see CDeterministicMNList::CalcMaxPoSePenalty()),
|
||||
# so nodes are PoSe-banned in the same DKG they misbehave without being PoSe-punished first.
|
||||
if instant_ban:
|
||||
assert expected_connections is not None
|
||||
self.reset_probe_timeouts()
|
||||
self.mine_quorum(expected_connections=expected_connections, expected_members=expected_contributors, expected_contributions=expected_contributors, expected_complaints=expected_complaints, expected_commitments=expected_contributors, mninfos_online=mninfos_online, mninfos_valid=mninfos_valid)
|
||||
else:
|
||||
# It's ok to miss probes/quorum connections up to 5 times.
|
||||
# 6th time is when it should be banned for sure.
|
||||
assert expected_connections is None
|
||||
for _ in range(6):
|
||||
self.reset_probe_timeouts()
|
||||
self.mine_quorum_less_checks(expected_contributors - 1, mninfos_online)
|
||||
|
Loading…
Reference in New Issue
Block a user