Skip to content

Commit 32abe69

Browse files
zhiqiangxuWoodpile37
authored andcommitted
CommitteeCache.get_all_beacon_committees: set correct capacity to avoid realloc (sigp#4557)
1 parent 6e098b4 commit 32abe69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

consensus/types/src/beacon_state/committee_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl CommitteeCache {
174174
.ok_or(Error::CommitteeCacheUninitialized(None))?;
175175

176176
initialized_epoch.slot_iter(self.slots_per_epoch).try_fold(
177-
Vec::with_capacity(self.slots_per_epoch as usize),
177+
Vec::with_capacity(self.epoch_committee_count()),
178178
|mut vec, slot| {
179179
vec.append(&mut self.get_beacon_committees_at_slot(slot)?);
180180
Ok(vec)

0 commit comments

Comments
 (0)