From a86a96d17b37a30ba0664cda01ef42d2d8e16a15 Mon Sep 17 00:00:00 2001 From: azuchi Date: Mon, 6 Jul 2026 13:33:01 +0900 Subject: [PATCH 1/3] test: add CHECKSIGVERIFY/CHECKMULTISIGVERIFY failure script test vectors --- src/test/data/script_tests.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json index 25581c4d641..a90ec795ca5 100644 --- a/src/test/data/script_tests.json +++ b/src/test/data/script_tests.json @@ -2569,6 +2569,10 @@ "P2SH(P2WSH) CHECKMULTISIG with second key uncompressed and signing with the second key" ], +["CHECKSIGVERIFY and CHECKMULTISIGVERIFY failure tests"], +["0", "0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 CHECKSIGVERIFY 1", "P2SH,STRICTENC", "CHECKSIGVERIFY", "CHECKSIGVERIFY fails with its own error code when the signature check fails"], +["0 0", "1 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 1 CHECKMULTISIGVERIFY 1", "P2SH,STRICTENC", "CHECKMULTISIGVERIFY", "CHECKMULTISIGVERIFY fails with its own error code when the signature check fails"], + ["CHECKSEQUENCEVERIFY tests"], ["", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "INVALID_STACK_OPERATION", "CSV automatically fails on an empty stack"], ["-1", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "NEGATIVE_LOCKTIME", "CSV automatically fails if stack top is negative"], From 37edf0e2338e4ae811ec224bf27d143ffbee25e6 Mon Sep 17 00:00:00 2001 From: azuchi Date: Mon, 6 Jul 2026 13:35:42 +0900 Subject: [PATCH 2/3] test: add CHECKLOCKTIMEVERIFY failure-path script test vectors --- src/test/data/script_tests.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json index a90ec795ca5..027f198677d 100644 --- a/src/test/data/script_tests.json +++ b/src/test/data/script_tests.json @@ -2573,6 +2573,19 @@ ["0", "0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 CHECKSIGVERIFY 1", "P2SH,STRICTENC", "CHECKSIGVERIFY", "CHECKSIGVERIFY fails with its own error code when the signature check fails"], ["0 0", "1 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 1 CHECKMULTISIGVERIFY 1", "P2SH,STRICTENC", "CHECKMULTISIGVERIFY", "CHECKMULTISIGVERIFY fails with its own error code when the signature check fails"], +["CHECKLOCKTIMEVERIFY tests"], +["All tests below can only exercise failure paths: the spending transaction in these tests"], +["has nLockTime 0 and a final nSequence, so CheckLockTime never succeeds."], +["", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY", "INVALID_STACK_OPERATION", "CLTV automatically fails on an empty stack"], +["-1", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY", "NEGATIVE_LOCKTIME", "CLTV automatically fails if stack top is negative"], +["0x0180", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY", "UNSATISFIED_LOCKTIME", "Negative zero is treated as 0, so CLTV fails with UNSATISFIED_LOCKTIME rather than NEGATIVE_LOCKTIME"], +["0x0100", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY,MINIMALDATA", "SCRIPTNUM", "CLTV use is non-standard if stack top is not minimally encoded"], +["0", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY", "UNSATISFIED_LOCKTIME", "CLTV fails if the input's nSequence is final, even when the lock time requirement is met"], +["499999999", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY", "UNSATISFIED_LOCKTIME", "CLTV fails if the stack operand (height) is greater than the tx nLockTime"], +["500000000", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY", "UNSATISFIED_LOCKTIME", "CLTV fails if the operand is time-based while the tx nLockTime is height-based"], +["0x050000000001", "CHECKLOCKTIMEVERIFY", "CHECKLOCKTIMEVERIFY", "UNSATISFIED_LOCKTIME", + "CLTV accepts a 5-byte operand (2^32), but it is time-based while the tx nLockTime is height-based"], + ["CHECKSEQUENCEVERIFY tests"], ["", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "INVALID_STACK_OPERATION", "CSV automatically fails on an empty stack"], ["-1", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "NEGATIVE_LOCKTIME", "CSV automatically fails if stack top is negative"], From c4068cf37b6674417c77ce1f295b51dd49a57e81 Mon Sep 17 00:00:00 2001 From: azuchi Date: Wed, 8 Jul 2026 09:55:24 +0900 Subject: [PATCH 3/3] test: add negative zero CSV failure script test vector --- src/test/data/script_tests.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json index 027f198677d..b88c6415472 100644 --- a/src/test/data/script_tests.json +++ b/src/test/data/script_tests.json @@ -2589,6 +2589,7 @@ ["CHECKSEQUENCEVERIFY tests"], ["", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "INVALID_STACK_OPERATION", "CSV automatically fails on an empty stack"], ["-1", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "NEGATIVE_LOCKTIME", "CSV automatically fails if stack top is negative"], +["0x0180", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "UNSATISFIED_LOCKTIME", "Negative zero is treated as 0, so CSV fails with UNSATISFIED_LOCKTIME rather than NEGATIVE_LOCKTIME"], ["0x0100", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY,MINIMALDATA", "SCRIPTNUM", "CSV fails if stack top is not minimally encoded"], ["0", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "UNSATISFIED_LOCKTIME", "CSV fails if stack top bit 1 << 31 is set and the tx version < 2"], ["0x050000000001", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "UNSATISFIED_LOCKTIME",