Skip to content

Commit 09f706a

Browse files
committed
test: check for OP_CSV empty stack fail reject reason in feature_csv_activation.py
1 parent cbd345a commit 09f706a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/functional/feature_csv_activation.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def set_test_params(self):
150150
151151
'-blockversion=4',
152152
'-addresstype=legacy',
153+
'-par=1', # Use only one script thread to get the exact reject reason for testing
153154
]]
154155
self.supports_cli = False
155156

@@ -175,11 +176,11 @@ def create_test_block(self, txs):
175176
block.solve()
176177
return block
177178

178-
def send_blocks(self, blocks, success=True):
179+
def send_blocks(self, blocks, success=True, reject_reason=None):
179180
"""Sends blocks to test node. Syncs and verifies that tip has advanced to most recent block.
180181
181182
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)
183184

184185
def run_test(self):
185186
self.nodes[0].add_p2p_connection(P2PDataStore())
@@ -402,7 +403,8 @@ def run_test(self):
402403

403404
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
404405
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)')
406408
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 1 txs should still pass
407409

408410
success_txs = [tx['tx'] for tx in bip112txs_vary_OP_CSV_v1 if tx['sdf']]
@@ -422,7 +424,8 @@ def run_test(self):
422424

423425
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
424426
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)')
426429

427430
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 2 txs should pass (all sequence locks are met)
428431
success_txs = [tx['tx'] for tx in bip112txs_vary_OP_CSV_v2 if tx['sdf']]

0 commit comments

Comments
 (0)