diff --git a/beacon_node/operation_pool/src/attestation_storage.rs b/beacon_node/operation_pool/src/attestation_storage.rs index e077fd9e5e0..5a5209e5bb0 100644 --- a/beacon_node/operation_pool/src/attestation_storage.rs +++ b/beacon_node/operation_pool/src/attestation_storage.rs @@ -244,17 +244,12 @@ impl AttestationDataMap { pub fn stats(&self) -> AttestationStats { let mut stats = AttestationStats::default(); - let mut max_aggregates_per_data = 0; - for (_, aggregates) in self.aggregate_attestations.iter() { + for aggregates in self.aggregate_attestations.values() { stats.num_attestations += aggregates.len(); stats.num_attestation_data += 1; stats.max_aggregates_per_data = std::cmp::max(stats.max_aggregates_per_data, aggregates.len()); - - if aggregates.len() > max_aggregates_per_data { - max_aggregates_per_data = aggregates.len(); - } } for (data, unaggregates) in self.unaggregate_attestations.iter() { diff --git a/beacon_node/operation_pool/src/bron_kerbosch.rs b/beacon_node/operation_pool/src/bron_kerbosch.rs index b66ecade037..28b8a6222e0 100644 --- a/beacon_node/operation_pool/src/bron_kerbosch.rs +++ b/beacon_node/operation_pool/src/bron_kerbosch.rs @@ -57,7 +57,7 @@ fn compute_neighbourhoods bool>( let mut neighbourhoods = vec![]; neighbourhoods.resize_with(vertices.len(), Vec::new); for (i, vi) in vertices.get(0..vertices.len() - 1)?.iter().enumerate() { - for (j, vj) in vertices.get(i + 1..vertices.len())?.iter().enumerate() { + for (j, vj) in vertices.iter().enumerate().skip(i + 1) { if is_compatible(vi, vj) { neighbourhoods.get_mut(i)?.push(j); neighbourhoods.get_mut(j)?.push(i); diff --git a/beacon_node/operation_pool/src/lib.rs b/beacon_node/operation_pool/src/lib.rs index 2e64a412957..69bf838df54 100644 --- a/beacon_node/operation_pool/src/lib.rs +++ b/beacon_node/operation_pool/src/lib.rs @@ -1309,20 +1309,22 @@ mod release_tests { } } - let mut num_valid = 0; + let num_valid = AtomicUsize::new(0); let (_, curr) = CheckpointKey::keys_for_state(&state); let all_attestations = op_pool.attestations.read(); complete_state_advance(&mut state, None, Slot::new(1), spec).unwrap(); - let clique_attestations = op_pool.get_clique_aggregate_attestations_for_epoch( - &curr, - &all_attestations, - &state, - |_| true, - &mut num_valid, - 32, - spec, - ); + let clique_attestations = op_pool + .get_clique_aggregate_attestations_for_epoch( + &curr, + &all_attestations, + &state, + |_| true, + &num_valid, + 32, + spec, + ) + .unwrap(); let best_attestations = op_pool .get_attestations(&state, |_| true, |_| true, 32, spec) .unwrap();