mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
CommitteeCache.get_all_beacon_committees: set correct capacity to avoid realloc (#4557)
This commit is contained in:
@@ -174,7 +174,7 @@ impl CommitteeCache {
|
|||||||
.ok_or(Error::CommitteeCacheUninitialized(None))?;
|
.ok_or(Error::CommitteeCacheUninitialized(None))?;
|
||||||
|
|
||||||
initialized_epoch.slot_iter(self.slots_per_epoch).try_fold(
|
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| {
|
|mut vec, slot| {
|
||||||
vec.append(&mut self.get_beacon_committees_at_slot(slot)?);
|
vec.append(&mut self.get_beacon_committees_at_slot(slot)?);
|
||||||
Ok(vec)
|
Ok(vec)
|
||||||
|
|||||||
Reference in New Issue
Block a user