Skip to content

Commit 9697228

Browse files
committed
fix: remove vec merkle_tree
1 parent 1c1c021 commit 9697228

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

primitives/src/merkle_tree.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@ impl Algorithm<MerkleItem> for KeccakAlgorithm {
5353
}
5454

5555
fn node(&mut self, left: MerkleItem, right: MerkleItem, _height: usize) -> MerkleItem {
56-
let left_vec: Vec<u8> = left.to_vec();
57-
let right_vec: Vec<u8> = right.to_vec();
5856
// This is a check for odd number of leaves items
5957
// left == right since the right is a duplicate of left
6058
// return the item unencoded as the JS impl
61-
if right_vec == left_vec {
59+
if left == right {
6260
left
6361
} else {
64-
let mut node_vec = vec![left_vec, right_vec];
62+
let mut node_vec = vec![left.to_vec(), right.to_vec()];
6563
node_vec.sort();
6664

6765
let flatten_node_vec: Vec<u8> = node_vec.into_iter().flatten().collect();

0 commit comments

Comments
 (0)