|
@ -200,7 +200,7 @@ impl MerkleHashTree { |
|
|
|
|
|
|
|
|
// Check that the given index corresponds to the correct leaf.
|
|
|
// Check that the given index corresponds to the correct leaf.
|
|
|
if leaf_hash != self.tree[tree_index] {
|
|
|
if leaf_hash != self.tree[tree_index] {
|
|
|
Err(MerkleTreeError::IncorrectLeafIndex(tree_index))?
|
|
|
|
|
|
|
|
|
return Err(MerkleTreeError::IncorrectLeafIndex(tree_index).into())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// Iterate from the leaf up to the root, storing all intermediate hash values.
|
|
|
// Iterate from the leaf up to the root, storing all intermediate hash values.
|
|
@ -230,7 +230,7 @@ impl MerkleHashTree { |
|
|
}
|
|
|
}
|
|
|
end_timer!(prove_time);
|
|
|
end_timer!(prove_time);
|
|
|
if path.len() != (Self::HEIGHT - 1) as usize {
|
|
|
if path.len() != (Self::HEIGHT - 1) as usize {
|
|
|
Err(MerkleTreeError::IncorrectPathLength(path.len()))?
|
|
|
|
|
|
|
|
|
return Err(MerkleTreeError::IncorrectPathLength(path.len()).into())
|
|
|
} else {
|
|
|
} else {
|
|
|
Ok(MerkleTreePath { path })
|
|
|
Ok(MerkleTreePath { path })
|
|
|
}
|
|
|
}
|
|
|