Skip to content

Commit

Permalink
Remove the locked_set method.
Browse files Browse the repository at this point in the history
This was shared at one point between the set and expand functions.
Since expand was replaced by `resize`, it is no longer needed.
  • Loading branch information
eljobe committed May 3, 2024
1 parent e67b0e1 commit fc9e88f
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions arbitrator/prover/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use sha3::Keccak256;
use std::{
collections::HashSet,
convert::{TryFrom, TryInto},
sync::{Arc, Mutex, MutexGuard},
sync::{Arc, Mutex},
};

#[cfg(feature = "rayon")]
Expand Down Expand Up @@ -371,19 +371,10 @@ impl Merkle {
#[cfg(feature = "counters")]
SET_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed);
let mut layers = self.layers.lock().unwrap();
self.locked_set(&mut layers, idx, hash);
}

fn locked_set(
&self,
locked_layers: &mut MutexGuard<Vec<Vec<Bytes32>>>,
idx: usize,
hash: Bytes32,
) {
if locked_layers[0][idx] == hash {
if layers[0][idx] == hash {
return;
}
locked_layers[0][idx] = hash;
layers[0][idx] = hash;
self.dirty_layers.lock().unwrap()[0].insert(idx >> 1);
}

Expand Down

0 comments on commit fc9e88f

Please sign in to comment.