test: add negative zero CSV failure script test vector
What changed, and why it matters
This commit only adds a new test case to Bitcoin Core's script test suite. It verifies that a special edge-case number ('negative zero') is treated as plain zero by the CHECKSEQUENCEVERIFY opcode and therefore fails with the expected 'unsatisfied locktime' error rather than a 'negative number' error. There is no change to production code, no bug fix, and no security patch.
No action required. This is a test-only addition and does not alter node behavior or consensus rules.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds one JSON test vector in src/test/data/script_tests.json. The vector pushes a minimally-encoded negative zero (0x0180, length 1 byte with sign bit set) onto the stack and runs CHECKSEQUENCEVERIFY. The expected result is UNSATISFIED_LOCKTIME, confirming that CScriptNum canonicalizes -0 to 0 and does not treat it as negative. This is purely a regression/edge-case test; no consensus or P2P code is modified.
Changed components
src/test/data/script_tests.jsonInspect captured patch +1 / −0
diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json
index 027f1986..b88c6415 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",
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.