aboutsummaryrefslogtreecommitdiff
path: root/test/functional/data/invalid_txs.py
diff options
context:
space:
mode:
authormerge-script <fanquake@gmail.com>2024-10-21 14:58:44 +0100
committermerge-script <fanquake@gmail.com>2024-10-21 14:58:44 +0100
commitd9f8dc645343a4432fca75c5fa2156e8cf06efae (patch)
tree0c6429355f4da41dd19062aa24ab05948fa9c4d6 /test/functional/data/invalid_txs.py
parent563c4d292687d2fd7aa3d21eef7a8256cd645c21 (diff)
parent86e2a6b749c7fecbd086b361806ac9f6e9426d79 (diff)
Merge bitcoin/bitcoin#31097: validation: Improve input script check error reporting
86e2a6b749c7fecbd086b361806ac9f6e9426d79 [test] A non-standard transaction which is also consensus-invalid should return the consensus error (Antoine Poinsot) f859ff8a4e9c3aa23bf5be6eceb7099ca72b2290 [validation] Improve script check error reporting (dergoegge) Pull request description: An input script might be invalid for multiple reasons. For example, it might fail both a standardness check and a consensus check, which can lead to a `mandatory-script-verify-flag-failed` error being reported that includes the script error string from the standardness failure (e.g. `mandatory-script-verify-flag-failed (Using OP_CODESEPARATOR in non-witness script)`), which is confusing. ACKs for top commit: darosior: re-ACK 86e2a6b749c7fecbd086b361806ac9f6e9426d79 ariard: Re-Code Review ACK 86e2a6b7 instagibbs: ACK 86e2a6b749c7fecbd086b361806ac9f6e9426d79 Tree-SHA512: 053939107c0bcd6643e9006b2518ddc3a6de47d2c6c66af71a04e8af5cf9ec207f19e54583b7a056efd77571edf5fd4f36c31ebe80d1f0777219c756c055eb42
Diffstat (limited to 'test/functional/data/invalid_txs.py')
-rw-r--r--test/functional/data/invalid_txs.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/data/invalid_txs.py b/test/functional/data/invalid_txs.py
index 2e4ca83bf0..d2d7202d86 100644
--- a/test/functional/data/invalid_txs.py
+++ b/test/functional/data/invalid_txs.py
@@ -263,6 +263,17 @@ def getDisabledOpcodeTemplate(opcode):
'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,