@@ -142,7 +142,7 @@ def check_mempool_result(self, result_expected, tx):
142142 assert_equal ([result_expected ], result_test )
143143 self .check_mempool_size ()
144144
145- def create_and_check_block (self , tx , expected_error = None ):
145+ def create_and_check_block (self , txes , expected_error = None ):
146146 node = self .nodes [0 ]
147147 best_block_hash = node .getbestblockhash ()
148148 best_block = node .getblock (best_block_hash )
@@ -151,8 +151,10 @@ def create_and_check_block(self, tx, expected_error = None):
151151 block_time = best_block ["time" ] + 1
152152
153153 cbb = create_coinbase (height , dip4_activated = True , v20_activated = True )
154+ cbb .calc_sha256 ()
154155 block = create_block (tip , cbb , block_time , version = 3 )
155- block .vtx .append (tx )
156+ for tx in txes :
157+ block .vtx .append (tx )
156158 block .hashMerkleRoot = block .calc_merkle_root ()
157159 block .solve ()
158160 result = node .submitblock (block .serialize ().hex ())
@@ -265,6 +267,10 @@ def run_test(self):
265267 assert_equal (get_credit_pool_amount (node ), locked_1 )
266268 self .sync_all ()
267269
270+ self .log .info ('Mine block with incorrect credit-poool value...' )
271+ extra_lock_tx = create_assetlock (node , coin , COIN , pubkey )
272+ self .create_and_check_block ([extra_lock_tx ], expected_error = 'bad-cbtx-assetlocked-amount' )
273+
268274 self .log .info ("Mine a quorum..." )
269275 self .mine_quorum ()
270276 assert_equal (get_credit_pool_amount (node ), locked_1 )
@@ -362,7 +368,7 @@ def run_test(self):
362368 assert_equal (get_credit_pool_amount (node ), locked_1 - 3 * COIN )
363369
364370 # Forcibly mine asset_unlock_tx_too_late and ensure block is invalid
365- self .create_and_check_block (asset_unlock_tx_too_late , expected_error = "bad-assetunlock-not-active-quorum" )
371+ self .create_and_check_block ([ asset_unlock_tx_too_late ] , expected_error = "bad-assetunlock-not-active-quorum" )
366372
367373 node .generate (1 )
368374 self .sync_all ()
@@ -384,7 +390,7 @@ def run_test(self):
384390 self .ensure_tx_is_not_mined (txid_in_block )
385391
386392 # Forcibly mine asset_unlock_tx_full and ensure block is invalid
387- self .create_and_check_block (asset_unlock_tx_full , expected_error = "failed-creditpool-unlock-too-much" )
393+ self .create_and_check_block ([ asset_unlock_tx_full ] , expected_error = "failed-creditpool-unlock-too-much" )
388394
389395 self .mempool_size += 1
390396 asset_unlock_tx_full = create_assetunlock (node , self .mninfo , 301 , get_credit_pool_amount (node ), pubkey )
@@ -404,7 +410,7 @@ def run_test(self):
404410 reason = "double index" )
405411
406412 # Forcibly mine asset_unlock_tx_full and ensure block is invalid
407- self .create_and_check_block (asset_unlock_tx_duplicate_index , expected_error = "bad-assetunlock-duplicated-index" )
413+ self .create_and_check_block ([ asset_unlock_tx_duplicate_index ] , expected_error = "bad-assetunlock-duplicated-index" )
408414
409415 self .log .info ("Fast forward to the next day to reset all current unlock limits..." )
410416 self .slowly_generate_batch (blocks_in_one_day + 1 )
0 commit comments