Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Aug 11, 2022
1 parent a9655bf commit 3e005dc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions base_layer/core/src/chain_storage/blockchain_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1258,11 +1258,11 @@ pub fn calculate_mmr_roots<T: BlockchainBackend>(db: &T, block: &Block) -> Resul
let mut output_mmr = MutableMmr::<Blake256, _>::new(outputs, deleted)?;
let mut witness_mmr = MerkleMountainRange::<Blake256, _>::new(range_proofs);
let mut input_mmr = MerkleMountainRange::<Blake256, _>::new(PrunedHashSet::default());
let mut deleted_outputs = Vec::new();

for kernel in body.kernels().iter() {
kernel_mmr.push(kernel.hash())?;
}
let mut deleted_outputs = Vec::new();

for output in body.outputs().iter() {
let output_hash = output.hash();
Expand Down Expand Up @@ -1308,7 +1308,7 @@ pub fn calculate_mmr_roots<T: BlockchainBackend>(db: &T, block: &Block) -> Resul
};
deleted_outputs.push((index, output_hash));
}
for (index, output_hash) in deleted_outputs.into_iter() {
for (index, output_hash) in deleted_outputs {
if !output_mmr.delete(index) {
let num_leaves = u32::try_from(output_mmr.get_leaf_count())
.map_err(|_| ChainStorageError::CriticalError("UTXO MMR leaf count overflows u32".to_string()))?;
Expand All @@ -1318,7 +1318,6 @@ pub fn calculate_mmr_roots<T: BlockchainBackend>(db: &T, block: &Block) -> Resul
output_hash.to_hex()
)));
}

return Err(ChainStorageError::InvalidOperation(format!(
"Could not delete index {} from the output MMR ({} leaves)",
index, num_leaves
Expand Down

0 comments on commit 3e005dc

Please sign in to comment.