mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-30 16:06:30 +00:00
Improve allocation in get_attestation_participants
This commit is contained in:
parent
53456a6c79
commit
a44d80006a
@ -531,12 +531,14 @@ impl BeaconState {
|
||||
return Err(Error::InvalidBitfield);
|
||||
}
|
||||
|
||||
let mut participants = vec![];
|
||||
let mut participants = Vec::with_capacity(committee.len());
|
||||
for (i, validator_index) in committee.iter().enumerate() {
|
||||
if bitfield.get(i).unwrap() {
|
||||
participants.push(*validator_index);
|
||||
match bitfield.get(i) {
|
||||
Ok(bit) if bit == true => participants.push(*validator_index),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
participants.shrink_to_fit();
|
||||
|
||||
Ok(participants)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user