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

Delete unnecessary comments #59

Merged
merged 1 commit into from
May 4, 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
15 changes: 4 additions & 11 deletions src/merkletree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl MerkleTree {
}

for left_index in (1..nodes_total - 1).step_by(2).rev() {
//let mut hasher = Sha256::new();

let mut to_hash = [0u8; 32];
unsafe {
for (index, (left, right)) in array_representation
Expand All @@ -57,8 +57,7 @@ impl MerkleTree {
{
*to_hash.get_unchecked_mut(index) = *left & *right;
}
//hasher.reset();


let hash = Sha256::digest(to_hash);

*(array_representation.get_unchecked_mut((left_index - 1) / 2)) =
Expand Down Expand Up @@ -96,7 +95,7 @@ impl MerkleTree {
let lsb_set = index & 1;
let lsb_not_set = lsb_set ^ 1;

// let mut sibling_index = index;


index += lsb_set;
index -= lsb_not_set;
Expand Down Expand Up @@ -152,13 +151,7 @@ impl MerkleTree {
unsafe { self.array_representation.get_unchecked(0) }
}

// pub fn new() -> MerkleTree {
// todo!()
// }

// pub fn add_objects(&mut self, input: &Vec<[u8; 32]>) -> bool {
// todo!()
// }

}

#[cfg(test)]
Expand Down
Loading