What changed, and why it matters
This commit simply adds the standard Rust Hash trait to the Opcode type, allowing Opcode values to be used as keys in hash maps and sets. There is no security-relevant change: it does not alter existing behavior, add new functionality that processes untrusted data, or fix any vulnerability.
No security action required. Treat as a normal API enhancement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff changes one line in primitives/src/opcodes.rs, adding Hash to the derive macro for the Opcode struct. Opcode wraps a single u8 and already implemented Debug, Copy, Clone, PartialEq, and Eq. Adding Hash is a routine API completeness change with no logic modifications, no unsafe code, and no changes to serialization, parsing, or consensus rules.
Changed components
primitives/src/opcodes.rsInspect captured patch +1 / −1
diff --git a/primitives/src/opcodes.rs b/primitives/src/opcodes.rs
index 1c94a080..9b548a71 100644
--- a/primitives/src/opcodes.rs
+++ b/primitives/src/opcodes.rs
@@ -22,7 +22,7 @@ use core::fmt;
/// Bitcoin Core's `IsPushOnly` considers `OP_RESERVED` to be a "push code", allowing this opcode
/// in contexts where only pushes are supposed to be allowed.
/// </details>
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Opcode {
code: u8,
}
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.