Rename encode_to_hash_engine to encode_to_engine
What changed, and why it matters
This commit simply renames a helper function from encode_to_hash_engine to encode_to_engine and updates the one place that calls it. There is no security change; it is a routine code-style cleanup.
No security action needed. Treat as a normal refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is a pure identifier rename: hashes/src/lib.rs exports encode_to_engine instead of encode_to_hash_engine, and primitives/src/block.rs updates its call site. The function signature, behavior, and all logic remain identical. No cryptographic or memory-safety semantics are altered.
Changed components
hashes/src/lib.rsprimitives/src/block.rsInspect captured patch +2 / −2
diff --git a/hashes/src/lib.rs b/hashes/src/lib.rs
index bcb260cf..4f7e1d3a 100644
--- a/hashes/src/lib.rs
+++ b/hashes/src/lib.rs
@@ -201,7 +201,7 @@ pub trait HashEngine: Clone {
///
/// Consumes and returns the hash engine to make it easier to call
/// [`HashEngine::finalize`] directly on the result.
-pub fn encode_to_hash_engine<T, H>(object: &T, mut engine: H) -> H
+pub fn encode_to_engine<T, H>(object: &T, mut engine: H) -> H
where
T: encoding::Encodable + ?Sized,
H: HashEngine,
diff --git a/primitives/src/block.rs b/primitives/src/block.rs
index d306dc8e..77551f51 100644
--- a/primitives/src/block.rs
+++ b/primitives/src/block.rs
@@ -235,7 +235,7 @@ impl Header {
/// Returns the block hash.
// This is the same as `Encodable` but done manually because `Encodable` isn't in `primitives`.
pub fn block_hash(&self) -> BlockHash {
- let bare_hash = hashes::encode_to_hash_engine(self, sha256d::Hash::engine()).finalize();
+ let bare_hash = hashes::encode_to_engine(self, sha256d::Hash::engine()).finalize();
BlockHash::from_byte_array(bare_hash.to_byte_array())
}
}
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.