Skip to content

Commit

Permalink
avoid deadlock by sequential iter and collecting then par iter
Browse files Browse the repository at this point in the history
  • Loading branch information
GeemoCandama committed Nov 14, 2023
1 parent 0e2f24e commit 376c408
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion beacon_node/operation_pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<T: EthSpec> OperationPool<T> {
return Ok(vec![]);
};
let mut cliques_from_aggregates: Vec<_> = aggregate_attestations
.into_par_iter()
.iter()
.filter(|(data, _)| {
data.slot + spec.min_attestation_inclusion_delay <= state.slot()
&& state.slot() <= data.slot + T::slots_per_epoch()
Expand All @@ -272,6 +272,8 @@ impl<T: EthSpec> OperationPool<T> {
num_valid.fetch_add(aggregates.len(), Ordering::Relaxed);
(data, aggregates)
})
.collect::<Vec<_>>()
.into_par_iter()
.map(|(data, mut aggregates)| {
// Take the N aggregates with the highest number of set bits
// This is needed to avoid the bron_kerbosch algorithm generating millions of
Expand Down

0 comments on commit 376c408

Please sign in to comment.