From ee889b600d0d0d8298ce760e6c5457dfeefb1299 Mon Sep 17 00:00:00 2001 From: Anton Suprunchuk Date: Thu, 11 Jan 2024 19:58:05 +0700 Subject: [PATCH] fix vector conversion for hashes --- src/proof_serializers/direct_hashes_order.rs | 3 +-- src/proof_serializers/reverse_hashes_order.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/proof_serializers/direct_hashes_order.rs b/src/proof_serializers/direct_hashes_order.rs index 6ab9733..cd1cdf4 100644 --- a/src/proof_serializers/direct_hashes_order.rs +++ b/src/proof_serializers/direct_hashes_order.rs @@ -32,8 +32,7 @@ impl MerkleProofSerializer for DirectHashesOrder { let slice = bytes .get(slice_start..slice_end) .ok_or_else(Error::vec_to_hash_conversion_error)?; - let vec = - Vec::::try_from(slice).map_err(|_| Error::vec_to_hash_conversion_error())?; + let vec = Vec::from(slice); match T::Hash::try_from(vec) { Ok(val) => proof_hashes_slices.push(val), Err(_) => return Err(Error::vec_to_hash_conversion_error()), diff --git a/src/proof_serializers/reverse_hashes_order.rs b/src/proof_serializers/reverse_hashes_order.rs index 231c0c4..5f8a4d1 100644 --- a/src/proof_serializers/reverse_hashes_order.rs +++ b/src/proof_serializers/reverse_hashes_order.rs @@ -34,8 +34,7 @@ impl MerkleProofSerializer for ReverseHashesOrder { let slice = bytes .get(slice_start..slice_end) .ok_or_else(Error::vec_to_hash_conversion_error)?; - let vec = - Vec::::try_from(slice).map_err(|_| Error::vec_to_hash_conversion_error())?; + let vec = Vec::from(slice); match T::Hash::try_from(vec) { Ok(val) => proof_hashes_slices.push(val), Err(_) => return Err(Error::vec_to_hash_conversion_error()),