test: minor improvements for credit pool functional test

This commit is contained in:
Konstantin Akimov 2024-07-22 13:49:35 +07:00
parent 58f703247b
commit a2fe2b27d9
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -223,14 +223,14 @@ 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, amount): def slowly_generate_batch(self, count):
self.log.info(f"Slowly generate {amount} blocks") self.log.info(f"Slowly generate {count} blocks")
while amount > 0: while count > 0:
self.log.info(f"Generating batch of blocks {amount} left") self.log.info(f"Generating batch of blocks {count} left")
next = min(10, amount) batch = min(10, count)
amount -= next count -= batch
self.bump_mocktime(next) self.bump_mocktime(batch)
self.nodes[1].generate(next) self.nodes[1].generate(batch)
self.sync_all() self.sync_all()
def run_test(self): def run_test(self):
@ -381,7 +381,7 @@ class AssetLocksTest(DashTestFramework):
assert_equal(rawtx_is["chainlock"], False) assert_equal(rawtx_is["chainlock"], False)
assert not "confirmations" in rawtx assert not "confirmations" in rawtx
assert not "confirmations" in rawtx_is assert not "confirmations" in rawtx_is
# disable back IS self.log.info("Disable back IS")
self.set_sporks() self.set_sporks()
assert "assetUnlockTx" in node.getrawtransaction(txid, 1) assert "assetUnlockTx" in node.getrawtransaction(txid, 1)
@ -441,7 +441,7 @@ class AssetLocksTest(DashTestFramework):
inode.reconsiderblock(block_to_reconsider) inode.reconsiderblock(block_to_reconsider)
self.validate_credit_pool_balance(locked - 2 * COIN) self.validate_credit_pool_balance(locked - 2 * COIN)
self.log.info("Forcibly mining asset_unlock_tx_too_late and ensure block is invalid...") self.log.info("Forcibly mining asset_unlock_tx_too_late and ensure block is invalid")
self.create_and_check_block([asset_unlock_tx_too_late], expected_error = "bad-assetunlock-not-active-quorum") self.create_and_check_block([asset_unlock_tx_too_late], expected_error = "bad-assetunlock-not-active-quorum")
node.generate(1) node.generate(1)
@ -450,7 +450,7 @@ class AssetLocksTest(DashTestFramework):
self.validate_credit_pool_balance(locked - 2 * COIN) self.validate_credit_pool_balance(locked - 2 * COIN)
self.validate_credit_pool_balance(block_hash=self.block_hash_1, expected=locked) self.validate_credit_pool_balance(block_hash=self.block_hash_1, expected=locked)
self.log.info("Forcibly mine asset_unlock_tx_full and ensure block is invalid...") self.log.info("Forcibly mine asset_unlock_tx_duplicate_index and ensure block is invalid")
self.create_and_check_block([asset_unlock_tx_duplicate_index], expected_error = "bad-assetunlock-duplicated-index") self.create_and_check_block([asset_unlock_tx_duplicate_index], expected_error = "bad-assetunlock-duplicated-index")