feat: update functional tests for Mn EHF - to use same bit more than once

This commit is contained in:
Konstantin Akimov 2023-09-20 15:36:59 +07:00 committed by PastaPastaPasta
parent 7b18bc8368
commit 3973f2b925

View File

@ -31,12 +31,21 @@ class MnehfTest(DashTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
def restart_all_nodes(self): def restart_all_nodes(self, params=None):
for inode in range(self.num_nodes): for inode in range(self.num_nodes):
self.log.info(f"Restart node {inode} with {self.extra_args[inode]}") self.log.info(f"Restart node {inode} with {self.extra_args[inode]}")
self.restart_node(inode, self.extra_args[inode]) if params is not None:
for i in range(self.num_nodes - 1): self.extra_args[inode][0] = f"-vbparams=testdummy:{params[0]}:{params[1]}:12:12:12:5:0"
self.connect_nodes(i + 1, i) self.log.info(f"Actual restart options: {self.extra_args[inode]}")
self.restart_node(0)
for mn in self.mninfo:
index = mn.node.index
self.stop_node(index)
self.start_masternode(mn)
for i in range(len(self.nodes)):
self.connect_nodes(i, 0)
def create_mnehf(self, versionBit, pubkey=None): def create_mnehf(self, versionBit, pubkey=None):
# request ID = sha256("mnhf", versionBit) # request ID = sha256("mnhf", versionBit)
@ -219,6 +228,26 @@ class MnehfTest(DashTestFramework):
self.restart_all_nodes() self.restart_all_nodes()
self.check_fork('active') self.check_fork('active')
self.bump_mocktime(int(60 * 60 * 24 * 14))
node.generate(1)
self.sync_all()
self.restart_all_nodes(params=[self.mocktime, self.mocktime + 1000000])
self.mine_quorum()
ehf_tx_second = self.create_mnehf(28, pubkey)
assert_equal(get_bip9_details(node, 'testdummy')['status'], 'defined')
ehf_tx_sent = self.send_tx(ehf_tx_second)
node.generate(1)
self.sync_all()
self.check_fork('defined')
for i in range(10):
self.log.info(f"Generating {i} ...")
self.bump_mocktime(next)
node.generate(next)
self.sync_all()
self.check_fork('started')
if __name__ == '__main__': if __name__ == '__main__':