Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Cifko committed Feb 13, 2024
1 parent e02875b commit a6b7794
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions base_layer/mmr/src/balanced_binary_merkle_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use std::{
collections::{HashMap, HashSet},
convert::TryFrom,
f32::consts::E,
marker::PhantomData,
};

Expand Down Expand Up @@ -227,11 +226,14 @@ where D: Digest + DomainDigest

let hash = match hash_or_index {
MergedBalancedBinaryMerkleIndexOrHash::Index(index) => {
if !dangling_paths.remove(&(index as usize)) {
if !dangling_paths
.remove(&usize::try_from(index).map_err(|_| BalancedBinaryMerkleProofError::MathOverflow)?)
{
// If some path is joining our path, that path should have ended.
return Err(BalancedBinaryMerkleProofError::BadProofSemantics);
}
consumed.insert(index as usize);
consumed
.insert(usize::try_from(index).map_err(|_| BalancedBinaryMerkleProofError::MathOverflow)?);
let index = usize::try_from(index).map_err(|_| BalancedBinaryMerkleProofError::MathOverflow)?;

// The index must also point to one of the proofs
Expand Down

0 comments on commit a6b7794

Please sign in to comment.