Skip to content

Commit

Permalink
[test] A non-standard transaction which is also consensus-invalid sho…
Browse files Browse the repository at this point in the history
…uld return the consensus error
  • Loading branch information
darosior authored and dergoegge committed Oct 16, 2024
1 parent f859ff8 commit ad51775
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions test/functional/data/invalid_txs.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@ def get_tx(self):
'valid_in_block' : True
})

class NonStandardAndInvalid(BadTxTemplate):
"""A non-standard transaction which is also consensus-invalid should return the consensus error."""
reject_reason = "mandatory-script-verify-flag-failed (OP_RETURN was encountered)"
expect_disconnect = True
valid_in_block = False

def get_tx(self):
return create_tx_with_script(
self.spend_tx, 0, script_sig=b'\x00' * 3 + b'\xab\x6a',
amount=(self.spend_avail // 2))

# Disabled opcode tx templates (CVE-2010-5137)
DisabledOpcodeTemplates = [getDisabledOpcodeTemplate(opcode) for opcode in [
OP_CAT,
Expand Down
2 changes: 1 addition & 1 deletion test/functional/p2p_invalid_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def run_test(self):
node.p2ps[0].send_txs_and_test([rejected_parent], node, success=False)

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

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')
Expand Down

0 comments on commit ad51775

Please sign in to comment.