use of tech.pegasys.teku.spec.datastructures.state.PendingAttestation.PendingAttestationSchema in project teku by ConsenSys.
the class BeaconStatePhase0 method applyAdditionalFields.
@Override
protected void applyAdditionalFields(final MutableBeaconState state) {
state.toMutableVersionPhase0().ifPresent(mutableState -> {
final PendingAttestationSchema pendingAttestationSchema = mutableState.getBeaconStateSchema().getPendingAttestationSchema();
mutableState.getPrevious_epoch_attestations().setAll(previous_epoch_attestations.stream().map(pendingAttestation -> pendingAttestation.asInternalPendingAttestation(pendingAttestationSchema)).collect(Collectors.toList()));
mutableState.getCurrent_epoch_attestations().setAll(current_epoch_attestations.stream().map(pendingAttestation -> pendingAttestation.asInternalPendingAttestation(pendingAttestationSchema)).collect(Collectors.toList()));
});
}
use of tech.pegasys.teku.spec.datastructures.state.PendingAttestation.PendingAttestationSchema in project teku by ConsenSys.
the class DataStructureUtil method randomPendingAttestation.
public PendingAttestation randomPendingAttestation() {
final BeaconStateSchema<?, ?> beaconStateSchema = getBeaconStateSchema();
checkState(beaconStateSchema instanceof BeaconStateSchemaPhase0, "Pending attestations only exist in phase0");
final PendingAttestationSchema pendingAttestationSchema = ((BeaconStateSchemaPhase0) beaconStateSchema).getPendingAttestationSchema();
return randomPendingAttestation(pendingAttestationSchema);
}
use of tech.pegasys.teku.spec.datastructures.state.PendingAttestation.PendingAttestationSchema in project teku by ConsenSys.
the class BeaconStateSchemaPhase0 method getUniqueFields.
private static List<SszField> getUniqueFields(final SpecConfig specConfig) {
final PendingAttestationSchema pendingAttestationSchema = new PendingAttestationSchema(specConfig);
final SszField previousEpochAttestationsField = new SszField(15, BeaconStateFields.PREVIOUS_EPOCH_ATTESTATIONS, () -> SszListSchema.create(pendingAttestationSchema, (long) specConfig.getMaxAttestations() * specConfig.getSlotsPerEpoch()));
final SszField currentEpochAttestationsField = new SszField(16, BeaconStateFields.CURRENT_EPOCH_ATTESTATIONS, () -> SszListSchema.create(pendingAttestationSchema, (long) specConfig.getMaxAttestations() * specConfig.getSlotsPerEpoch()));
return List.of(previousEpochAttestationsField, currentEpochAttestationsField);
}
Aggregations