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 (sigp#4557)
  • Loading branch information
zhiqiangxu authored and Woodpile37 committed Jan 6, 2024
1 parent d40c073 commit 9399ffa
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 9399ffa

Please sign in to comment.