From 4c57ad1c050ca27c0ff356afbb7c26a9a3d52141 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Fri, 13 Sep 2024 12:58:27 +0700 Subject: [PATCH] chore: increase batch size from 10 to 50 for faster block generation in functional tests It significantly improve speed of forks activation because reduces overhead for block generations Bigger batch size can cause time-outs for RPC for tsan job (time-out is 30 seconds) --- test/functional/feature_asset_locks.py | 16 ++++++++-------- test/functional/test_framework/test_framework.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/functional/feature_asset_locks.py b/test/functional/feature_asset_locks.py index 23b5d03e1f..de207dbb94 100755 --- a/test/functional/feature_asset_locks.py +++ b/test/functional/feature_asset_locks.py @@ -219,11 +219,11 @@ class AssetLocksTest(DashTestFramework): except JSONRPCException as e: assert expected_error in e.error['message'] - def slowly_generate_batch(self, count): - self.log.info(f"Slowly generate {count} blocks") + def generate_batch(self, count): + self.log.info(f"Generate {count} blocks") while count > 0: self.log.info(f"Generating batch of blocks {count} left") - batch = min(10, count) + batch = min(50, count) count -= batch self.bump_mocktime(batch) self.nodes[1].generate(batch) @@ -426,7 +426,7 @@ class AssetLocksTest(DashTestFramework): self.validate_credit_pool_balance(locked - 2 * COIN) self.log.info("Generating many blocks to make quorum far behind (even still active)...") - self.slowly_generate_batch(too_late_height - node.getblockcount() - 1) + self.generate_batch(too_late_height - node.getblockcount() - 1) self.check_mempool_result(tx=asset_unlock_tx_too_late, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}}) node.generate(1) self.sync_all() @@ -444,7 +444,7 @@ class AssetLocksTest(DashTestFramework): for inode in self.nodes: inode.invalidateblock(block_asset_unlock) self.validate_credit_pool_balance(locked) - self.slowly_generate_batch(50) + self.generate_batch(50) self.validate_credit_pool_balance(locked) for inode in self.nodes: inode.reconsiderblock(block_to_reconsider) @@ -510,7 +510,7 @@ class AssetLocksTest(DashTestFramework): assert spend_txid_in_block in block['tx'] self.log.info("Fast forward to the next day to reset all current unlock limits...") - self.slowly_generate_batch(blocks_in_one_day) + self.generate_batch(blocks_in_one_day) self.mine_quorum_2_nodes(llmq_type_name='llmq_test_platform', llmq_type=106) total = self.get_credit_pool_balance() @@ -585,7 +585,7 @@ class AssetLocksTest(DashTestFramework): assert pending_txid in node.getrawmempool() self.log.info("Fast forward to next day again...") - self.slowly_generate_batch(blocks_in_one_day - 1) + self.generate_batch(blocks_in_one_day - 1) self.log.info("Checking mempool is empty now...") self.mempool_size = 0 self.check_mempool_size() @@ -618,7 +618,7 @@ class AssetLocksTest(DashTestFramework): self.log.info("generate many blocks to be sure that mempool is empty after expiring txes...") - self.slowly_generate_batch(60) + self.generate_batch(60) self.log.info("Checking that credit pool is not changed...") assert_equal(new_total, self.get_credit_pool_balance()) self.check_mempool_size() diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index ccbc459667..758cac21eb 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -1136,7 +1136,7 @@ class DashTestFramework(BitcoinTestFramework): self.wait_for_sporks_same() # mine blocks in batches - batch_size = 10 + batch_size = 50 if expected_activation_height is not None: height = self.nodes[0].getblockcount() assert height < expected_activation_height