From b741f3a4b0dca6e71103cc42a0e259604fc68aeb Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 31 May 2023 23:34:30 +0300 Subject: [PATCH] test: Fix dynamically_smth_masternode helpers, extend feature_dip3_v19.py (#5402) ## Issue being fixed or feature implemented fix a couple of issues in helpers, extend feature_dip3_v19.py to check more after v19 fork ## What was done? pls see individual PRs ## How Has This Been Tested? run tests ## Breaking Changes n/a ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ --- test/functional/feature_dip3_v19.py | 16 +++++++++++++++- test/functional/test_framework/test_framework.py | 16 ++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/test/functional/feature_dip3_v19.py b/test/functional/feature_dip3_v19.py index 87a175610f..855bb76451 100755 --- a/test/functional/feature_dip3_v19.py +++ b/test/functional/feature_dip3_v19.py @@ -101,8 +101,22 @@ class DIP3V19Test(DashTestFramework): self.test_revoke_protx(revoke_protx, revoke_keyoperator) self.mine_quorum(llmq_type_name='llmq_test', llmq_type=100) + # revoking a MN results in disconnects, reconnect it back to let sync_blocks finish correctly + self.connect_nodes(hpmn_info_3.nodeIdx, 0) - return + self.log.info("Checking that adding more regular MNs after v19 doesn't break DKGs and IS/CLs") + + for i in range(6): + new_mn = self.dynamically_add_masternode(hpmn=False, rnd=(10 + i)) + assert new_mn is not None + + # mine more quorums and make sure everything still works + prev_quorum = None + for _ in range(5): + quorum = self.mine_quorum() + assert prev_quorum != quorum + + self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash()) def test_revoke_protx(self, revoke_protx, revoke_keyoperator): funds_address = self.nodes[0].getnewaddress() diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 1ee14328cf..049cd81831 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -1120,7 +1120,7 @@ class DashTestFramework(BitcoinTestFramework): created_mn_info = self.dynamically_prepare_masternode(mn_idx, node_p2p_port, hpmn, rnd) protx_success = True except: - self.log.info("protx_hpmn rejected") + self.log.info("dynamically_prepare_masternode failed") assert_equal(protx_success, not should_be_rejected) @@ -1136,7 +1136,7 @@ class DashTestFramework(BitcoinTestFramework): for mn_info in self.mninfo: if mn_info.proTxHash == created_mn_info.proTxHash: - mn_info.nodeIx = mn_idx + mn_info.nodeIdx = mn_idx mn_info.node = self.nodes[mn_idx] self.connect_nodes(mn_idx, 0) @@ -1157,8 +1157,8 @@ class DashTestFramework(BitcoinTestFramework): reward_address = self.nodes[0].getnewaddress() platform_node_id = hash160(b'%d' % rnd).hex() if rnd is not None else hash160(b'%d' % node_p2p_port).hex() - platform_p2p_port = '%d' % (node_p2p_port + 101) if hpmn else '' - platform_http_port = '%d' % (node_p2p_port + 102) if hpmn else '' + platform_p2p_port = '%d' % (node_p2p_port + 101) + platform_http_port = '%d' % (node_p2p_port + 102) collateral_amount = 4000 if hpmn else 1000 outputs = {collateral_address: collateral_amount, funds_address: 1} @@ -1179,8 +1179,12 @@ class DashTestFramework(BitcoinTestFramework): ipAndPort = '127.0.0.1:%d' % node_p2p_port operatorReward = idx - register_rpc = 'register_hpmn' if hpmn else 'register' - protx_result = self.nodes[0].protx(register_rpc, collateral_txid, collateral_vout, ipAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, platform_node_id, platform_p2p_port, platform_http_port, funds_address, True) + protx_result = None + if hpmn: + protx_result = self.nodes[0].protx("register_hpmn", collateral_txid, collateral_vout, ipAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, platform_node_id, platform_p2p_port, platform_http_port, funds_address, True) + else: + protx_result = self.nodes[0].protx("register", collateral_txid, collateral_vout, ipAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, funds_address, True) + self.wait_for_instantlock(protx_result, self.nodes[0]) tip = self.nodes[0].generate(1)[0] self.sync_all(self.nodes)