Skip to content

Commit

Permalink
CommitteeCache.get_all_beacon_committees: set correct capacity to avo…
Browse files Browse the repository at this point in the history
…id realloc (#4557)
  • Loading branch information
zhiqiangxu committed Aug 2, 2023
1 parent b5e25ae commit 7399a54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion consensus/types/src/beacon_state/committee_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl CommitteeCache {
.ok_or(Error::CommitteeCacheUninitialized(None))?;

initialized_epoch.slot_iter(self.slots_per_epoch).try_fold(
Vec::with_capacity(self.slots_per_epoch as usize),
Vec::with_capacity(self.epoch_committee_count()),
|mut vec, slot| {
vec.append(&mut self.get_beacon_committees_at_slot(slot)?);
Ok(vec)
Expand Down

0 comments on commit 7399a54

Please sign in to comment.