Fix attestations bug in block builder.

It was previously producing too many attestations in some scenarios.
This commit is contained in:
Paul Hauner 2019-03-10 08:31:40 +11:00
parent 90d00773cb
commit 5f3da0732f
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6

View File

@ -92,18 +92,20 @@ impl BeaconBlockBencher {
// - The slot is too old to be included in a block at this slot.
// - The `MAX_ATTESTATIONS`.
loop {
if attestations_added == spec.max_attestations {
break;
}
if state.slot >= slot + spec.slots_per_epoch {
break;
}
for (committee, shard) in state.get_crosslink_committees_at_slot(slot, spec)? {
committees.push((slot, committee.clone(), committee.clone(), *shard))
if attestations_added >= spec.max_attestations {
break;
}
committees.push((slot, committee.clone(), committee.clone(), *shard));
attestations_added += 1;
}
attestations_added += 1;
slot -= 1;
}