CommitteeCache.get_all_beacon_committees: set correct capacity to avoid realloc (#4557)
This commit is contained in:
parent
b5e25aeb2f
commit
7399a54ca3
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user