mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-10 16:01:28 +01:00
Prefer to return error rather than ? them,
avoid return when it cant be early (in a simple if-else)
This commit is contained in:
committed by
Pratyush Mishra
parent
10c6e85c1a
commit
d71bc5a675
@@ -200,7 +200,7 @@ impl<P: MerkleTreeConfig> MerkleHashTree<P> {
|
||||
|
||||
// Check that the given index corresponds to the correct leaf.
|
||||
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.
|
||||
@@ -230,7 +230,7 @@ impl<P: MerkleTreeConfig> MerkleHashTree<P> {
|
||||
}
|
||||
end_timer!(prove_time);
|
||||
if path.len() != (Self::HEIGHT - 1) as usize {
|
||||
Err(MerkleTreeError::IncorrectPathLength(path.len()))?
|
||||
return Err(MerkleTreeError::IncorrectPathLength(path.len()).into())
|
||||
} else {
|
||||
Ok(MerkleTreePath { path })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user