What changed, and why it matters
This commit only updates test code. It removes an 'ignore' marker from a test and corrects the expected byte output for pushing a single zero byte onto a Bitcoin script. There is no change to production code and no security issue.
No security action needed; this is a routine test fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies bitcoin/src/blockdata/script/tests.rs. It un-ignores the script() test and fixes two expectations: a push_slice([0u8]) now expects a 1-byte length prefix plus the zero byte (OP_PUSHBYTES_1 0x00) rather than a bare OP_0, while push_int(0) and empty-array pushes continue to expect OP_0. This aligns tests with existing push_slice behavior; no implementation code is changed.
Changed components
bitcoin/src/blockdata/script/tests.rsInspect captured patch +3 / −3
diff --git a/bitcoin/src/blockdata/script/tests.rs b/bitcoin/src/blockdata/script/tests.rs
index f5049092..cb1de49d 100644
--- a/bitcoin/src/blockdata/script/tests.rs
+++ b/bitcoin/src/blockdata/script/tests.rs
@@ -16,7 +16,6 @@ type Script = crate::ScriptSig;
type ScriptBuf = crate::ScriptSigBuf;
#[test]
-#[ignore] // bad test; will be fixed in next commit
#[rustfmt::skip]
fn script() {
let mut comp = vec![];
@@ -40,9 +39,10 @@ fn script() {
// data
script = script.push_slice(b"NRA4VR"); comp.extend([6u8, 78, 82, 65, 52, 86, 82].iter().cloned()); assert_eq!(script.as_bytes(), &comp[..]);
// data & number push minimality
- // OP_0
- script = script.push_slice([0u8]); comp.extend([0u8].iter().cloned()); assert_eq!(script.as_bytes(), &comp[..]);
+ // 0x00 (single byte)
+ script = script.push_slice([0u8]); comp.extend([1u8, 0].iter().cloned()); assert_eq!(script.as_bytes(), &comp[..]);
script = script.push_slice_non_minimal([0u8]); comp.extend([1, 0u8].iter().cloned()); assert_eq!(script.as_bytes(), &comp[..]);
+ // OP_0 (empty byte array)
script = script.push_int(0).unwrap(); comp.extend([0u8].iter().cloned()); assert_eq!(script.as_bytes(), &comp[..]);
script = script.push_int_non_minimal(0); comp.extend([0u8].iter().cloned()); assert_eq!(script.as_bytes(), &comp[..]);
// OP_1..16
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.