Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change Vec<u8> to Box<[u8]> for holding a node's hash pre-image #659

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions firewood/src/hashednode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ impl HasUpdate for Vec<u8> {
impl<T: ReadLinearStore> HashedNodeStore<T> {
/// Returns the serialized representation of `node` used as the pre-image
/// when hashing the node. The node is at the given `path_prefix`.
pub fn serialize_for_hashing(&self, node: &Node, path_prefix: &Path) -> Vec<u8> {
pub fn serialize_for_hashing(&self, node: &Node, path_prefix: &Path) -> Box<[u8]> {
let mut hasher = vec![];
self.hash_internal_with(node, path_prefix, &mut hasher);
hasher
hasher.into_boxed_slice()
}

// hash a node
Expand Down
Loading