Improve test of hash_types module borrow impl
What changed, and why it matters
This commit only adds an extra test line to verify that a Bitcoin hash type can be borrowed as a byte slice. It is a routine test-coverage improvement with no functional code changes and no security relevance.
No action required; this is a benign test-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds one assertion in the hash_types module unit tests: it checks that Borrow::<[u8]>::borrow(&txid) returns the same bytes as as_byte_array(). No production code is modified, no API behavior changes, and no bug is fixed.
Changed components
primitives/src/hash_types/mod.rs testsInspect captured patch +2 / −0
diff --git a/primitives/src/hash_types/mod.rs b/primitives/src/hash_types/mod.rs
index 1056dbbc..aa1cf2f5 100644
--- a/primitives/src/hash_types/mod.rs
+++ b/primitives/src/hash_types/mod.rs
@@ -302,10 +302,12 @@ mod tests {
let as_array: &[u8; 32] = tc.as_ref();
let as_slice: &[u8] = tc.as_ref();
let borrowed: &[u8; 32] = core::borrow::Borrow::<[u8; 32]>::borrow(&tc);
+ let borrowed_slice: &[u8] = core::borrow::Borrow::<[u8]>::borrow(&tc);
assert_eq!(as_array, tc.as_byte_array());
assert_eq!(borrowed, tc.as_byte_array());
assert_eq!(as_slice, tc.as_byte_array());
+ assert_eq!(borrowed_slice, tc.as_byte_array());
}
byte_array_roundtrip_test!(txid_byte_array_roundtrip, Txid, 32, 0x12);
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.