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)
This commit is contained in:
Konstantin Akimov 2024-09-13 12:58:27 +07:00
parent a9a2d4adbe
commit 4c57ad1c05
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
2 changed files with 9 additions and 9 deletions

View File

@ -219,11 +219,11 @@ class AssetLocksTest(DashTestFramework):
except JSONRPCException as e: except JSONRPCException as e:
assert expected_error in e.error['message'] assert expected_error in e.error['message']
def slowly_generate_batch(self, count): def generate_batch(self, count):
self.log.info(f"Slowly generate {count} blocks") self.log.info(f"Generate {count} blocks")
while count > 0: while count > 0:
self.log.info(f"Generating batch of blocks {count} left") self.log.info(f"Generating batch of blocks {count} left")
batch = min(10, count) batch = min(50, count)
count -= batch count -= batch
self.bump_mocktime(batch) self.bump_mocktime(batch)
self.nodes[1].generate(batch) self.nodes[1].generate(batch)
@ -426,7 +426,7 @@ class AssetLocksTest(DashTestFramework):
self.validate_credit_pool_balance(locked - 2 * COIN) self.validate_credit_pool_balance(locked - 2 * COIN)
self.log.info("Generating many blocks to make quorum far behind (even still active)...") 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))}}) self.check_mempool_result(tx=asset_unlock_tx_too_late, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
node.generate(1) node.generate(1)
self.sync_all() self.sync_all()
@ -444,7 +444,7 @@ class AssetLocksTest(DashTestFramework):
for inode in self.nodes: for inode in self.nodes:
inode.invalidateblock(block_asset_unlock) inode.invalidateblock(block_asset_unlock)
self.validate_credit_pool_balance(locked) self.validate_credit_pool_balance(locked)
self.slowly_generate_batch(50) self.generate_batch(50)
self.validate_credit_pool_balance(locked) self.validate_credit_pool_balance(locked)
for inode in self.nodes: for inode in self.nodes:
inode.reconsiderblock(block_to_reconsider) inode.reconsiderblock(block_to_reconsider)
@ -510,7 +510,7 @@ class AssetLocksTest(DashTestFramework):
assert spend_txid_in_block in block['tx'] assert spend_txid_in_block in block['tx']
self.log.info("Fast forward to the next day to reset all current unlock limits...") 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) self.mine_quorum_2_nodes(llmq_type_name='llmq_test_platform', llmq_type=106)
total = self.get_credit_pool_balance() total = self.get_credit_pool_balance()
@ -585,7 +585,7 @@ class AssetLocksTest(DashTestFramework):
assert pending_txid in node.getrawmempool() assert pending_txid in node.getrawmempool()
self.log.info("Fast forward to next day again...") 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.log.info("Checking mempool is empty now...")
self.mempool_size = 0 self.mempool_size = 0
self.check_mempool_size() 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.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...") self.log.info("Checking that credit pool is not changed...")
assert_equal(new_total, self.get_credit_pool_balance()) assert_equal(new_total, self.get_credit_pool_balance())
self.check_mempool_size() self.check_mempool_size()

View File

@ -1136,7 +1136,7 @@ class DashTestFramework(BitcoinTestFramework):
self.wait_for_sporks_same() self.wait_for_sporks_same()
# mine blocks in batches # mine blocks in batches
batch_size = 10 batch_size = 50
if expected_activation_height is not None: if expected_activation_height is not None:
height = self.nodes[0].getblockcount() height = self.nodes[0].getblockcount()
assert height < expected_activation_height assert height < expected_activation_height