Skip to content

Commit

Permalink
fix vector conversion for hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
antouhou committed Jan 11, 2024
1 parent cc44a14 commit ee889b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/proof_serializers/direct_hashes_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u8>::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()),
Expand Down
3 changes: 1 addition & 2 deletions src/proof_serializers/reverse_hashes_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u8>::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()),
Expand Down

0 comments on commit ee889b6

Please sign in to comment.