mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
6edbc9cebd
* Merge #9956: Reorganise qa directory63d66ba
Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py (John Newbery)5b0bff4
Rename --enable-extended-rpc-tests to --enable-extended-functional-tests (John Newbery)a9bd622
Rename test/pull-tester/rpc-tests.py to test/functional/test_runner.py (John Newbery)c28ee91
Rename rpc-tests directory to functional (John Newbery)00902c4
Rename qa directory to test (John Newbery) Tree-SHA512: ee7125c0c647d81590177beef2c8852c4ef76fdcf888096d9d4d360562a01d8d3b453345c3040487b2a043935bd1e7e80018f34462d6e02262bedbe23edcc576 resolve build errors Signed-off-by: Pasta <Pasta@dash.org> update test_runner.py in testintegrations.sh Signed-off-by: Pasta <Pasta@dash.org> * moved dash specific tests Signed-off-by: Pasta <Pasta@dash.org> * dashify README.md Signed-off-by: Pasta <Pasta@dash.org> * removed autoix*.py Signed-off-by: Pasta <Pasta@dash.org> * change back file perms * dedashify Signed-off-by: Pasta <Pasta@dash.org>
59 lines
1.9 KiB
Python
Executable File
59 lines
1.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2015-2018 The Dash Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
from test_framework.test_framework import DashTestFramework
|
|
from test_framework.util import *
|
|
from time import *
|
|
|
|
'''
|
|
llmq-simplepose.py
|
|
|
|
Checks simple PoSe system based on LLMQ commitments
|
|
|
|
'''
|
|
|
|
class LLMQSimplePoSeTest(DashTestFramework):
|
|
def __init__(self):
|
|
super().__init__(6, 5, [], fast_dip3_enforcement=True)
|
|
|
|
def run_test(self):
|
|
|
|
self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
|
self.wait_for_sporks_same()
|
|
|
|
# check if mining quorums with all nodes being online succeeds without punishment/banning
|
|
for i in range(3):
|
|
self.mine_quorum()
|
|
for mn in self.mninfo:
|
|
assert(not self.check_punished(mn) and not self.check_punished(mn))
|
|
|
|
# Now lets kill MNs one by one and verify that punishment/banning happens
|
|
for i in range(len(self.mninfo), len(self.mninfo) - 2, -1):
|
|
mn = self.mninfo[len(self.mninfo) - 1]
|
|
self.mninfo.remove(mn)
|
|
self.stop_node(mn.nodeIdx)
|
|
self.nodes.remove(mn.node)
|
|
|
|
t = time()
|
|
while (not self.check_punished(mn) or not self.check_banned(mn)) and (time() - t) < 120:
|
|
self.mine_quorum(expected_contributions=i-1, expected_complaints=i-1, expected_commitments=i-1)
|
|
|
|
assert(self.check_punished(mn) and self.check_banned(mn))
|
|
|
|
def check_punished(self, mn):
|
|
info = self.nodes[0].protx('info', mn.proTxHash)
|
|
if info['state']['PoSePenalty'] > 0:
|
|
return True
|
|
return False
|
|
|
|
def check_banned(self, mn):
|
|
info = self.nodes[0].protx('info', mn.proTxHash)
|
|
if info['state']['PoSeBanHeight'] != -1:
|
|
return True
|
|
return False
|
|
|
|
if __name__ == '__main__':
|
|
LLMQSimplePoSeTest().main()
|