@@ -150,6 +150,7 @@ def set_test_params(self):
150
150
151
151
'-blockversion=4' ,
152
152
'-addresstype=legacy' ,
153
+ '-par=1' , # Use only one script thread to get the exact reject reason for testing
153
154
]]
154
155
self .supports_cli = False
155
156
@@ -175,11 +176,11 @@ def create_test_block(self, txs):
175
176
block .solve ()
176
177
return block
177
178
178
- def send_blocks (self , blocks , success = True ):
179
+ def send_blocks (self , blocks , success = True , reject_reason = None ):
179
180
"""Sends blocks to test node. Syncs and verifies that tip has advanced to most recent block.
180
181
181
182
Call with success = False if the tip shouldn't advance to the most recent block."""
182
- self .nodes [0 ].p2p .send_blocks_and_test (blocks , self .nodes [0 ], success = success )
183
+ self .nodes [0 ].p2p .send_blocks_and_test (blocks , self .nodes [0 ], success = success , reject_reason = reject_reason )
183
184
184
185
def run_test (self ):
185
186
self .nodes [0 ].add_p2p_connection (P2PDataStore ())
@@ -402,7 +403,8 @@ def run_test(self):
402
403
403
404
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
404
405
self .send_blocks ([self .create_test_block ([bip112tx_special_v1 ])], success = False )
405
- self .send_blocks ([self .create_test_block ([bip112tx_emptystack_v1 ])], success = False )
406
+ self .send_blocks ([self .create_test_block ([bip112tx_emptystack_v1 ])], success = False ,
407
+ reject_reason = 'non-mandatory-script-verify-flag (Operation not valid with the current stack size)' )
406
408
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 1 txs should still pass
407
409
408
410
success_txs = [tx ['tx' ] for tx in bip112txs_vary_OP_CSV_v1 if tx ['sdf' ]]
@@ -422,7 +424,8 @@ def run_test(self):
422
424
423
425
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
424
426
self .send_blocks ([self .create_test_block ([bip112tx_special_v2 ])], success = False )
425
- self .send_blocks ([self .create_test_block ([bip112tx_emptystack_v2 ])], success = False )
427
+ self .send_blocks ([self .create_test_block ([bip112tx_emptystack_v2 ])], success = False ,
428
+ reject_reason = 'non-mandatory-script-verify-flag (Operation not valid with the current stack size)' )
426
429
427
430
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 2 txs should pass (all sequence locks are met)
428
431
success_txs = [tx ['tx' ] for tx in bip112txs_vary_OP_CSV_v2 if tx ['sdf' ]]
0 commit comments