Skip to content

Commit 86e2a6b

Browse files
darosiordergoegge
authored andcommitted
[test] A non-standard transaction which is also consensus-invalid should return the consensus error
1 parent f859ff8 commit 86e2a6b

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

test/functional/data/invalid_txs.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,17 @@ def get_tx(self):
263263
'valid_in_block' : True
264264
})
265265

266+
class NonStandardAndInvalid(BadTxTemplate):
267+
"""A non-standard transaction which is also consensus-invalid should return the consensus error."""
268+
reject_reason = "mandatory-script-verify-flag-failed (OP_RETURN was encountered)"
269+
expect_disconnect = True
270+
valid_in_block = False
271+
272+
def get_tx(self):
273+
return create_tx_with_script(
274+
self.spend_tx, 0, script_sig=b'\x00' * 3 + b'\xab\x6a',
275+
amount=(self.spend_avail // 2))
276+
266277
# Disabled opcode tx templates (CVE-2010-5137)
267278
DisabledOpcodeTemplates = [getDisabledOpcodeTemplate(opcode) for opcode in [
268279
OP_CAT,

test/functional/feature_block.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def set_test_params(self):
8888
self.extra_args = [[
8989
'-acceptnonstdtxn=1', # This is a consensus block test, we don't care about tx policy
9090
'-testactivationheight=bip34@2',
91+
'-par=1', # Until https://github.com/bitcoin/bitcoin/issues/30960 is fixed
9192
]]
9293

9394
def run_test(self):

test/functional/p2p_invalid_tx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def run_test(self):
165165
node.p2ps[0].send_txs_and_test([rejected_parent], node, success=False)
166166

167167
self.log.info('Test that a peer disconnection causes erase its transactions from the orphan pool')
168-
with node.assert_debug_log(['Erased 100 orphan transaction(s) from peer=25']):
168+
with node.assert_debug_log(['Erased 100 orphan transaction(s) from peer=26']):
169169
self.reconnect_p2p(num_connections=1)
170170

171171
self.log.info('Test that a transaction in the orphan pool is included in a new tip block causes erase this transaction from the orphan pool')

0 commit comments

Comments
 (0)