What changed, and why it matters
This commit only changes a code comment to make it clearer which Bitcoin script opcodes are treated as data pushes versus regular opcodes. No actual code behavior was changed, so there is no security impact.
No action needed; this is a documentation-only change with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff updates an inline comment in borrowed.rs for the last_pushdata() helper. It replaces a vague note about ‘op codes up to (but excluding) OP_PUSHNUM_NEG’ with a precise explanation that only Instruction::PushBytes results are returned, that OP_0 is included as an empty PushBytes, and that numeric push opcodes (OP_1NEGATE, OP_1..OP_16) and OP_RESERVED are excluded. The function body is untouched.
Changed components
bitcoin/src/blockdata/script/borrowed.rsInspect captured patch +4 / −1
diff --git a/bitcoin/src/blockdata/script/borrowed.rs b/bitcoin/src/blockdata/script/borrowed.rs
index 7433b670..f4cbd79b 100644
--- a/bitcoin/src/blockdata/script/borrowed.rs
+++ b/bitcoin/src/blockdata/script/borrowed.rs
@@ -529,7 +529,10 @@ internal_macros::define_extension_trait! {
/// Returns `None` if the instruction is an opcode or if the script is empty.
fn last_pushdata(&self) -> Option<&PushBytes> {
match self.instructions().last() {
- // Handles op codes up to (but excluding) OP_PUSHNUM_NEG.
+ // Returns only true data pushes.
+ // Note: OP_0 (empty push) is included as PushBytes; numeric push opcodes
+ // OP_1NEGATE and OP_1..OP_16 are opcodes (not pushdata) and thus excluded.
+ // OP_RESERVED is also excluded.
Some(Ok(Instruction::PushBytes(bytes))) => Some(bytes),
// OP_16 (0x60) and lower are considered "pushes" by Bitcoin Core (excl. OP_RESERVED).
// However we are only interested in the pushdata so we can ignore them.
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.