Search in sources :

Example 1 with SignedAttestation

use of tech.pegasys.teku.data.slashinginterchange.SignedAttestation in project teku by ConsenSys.

the class SlashingProtectionImporter method signingHistoryConverter.

private SigningHistory signingHistoryConverter(final SigningHistory signingHistory) {
    final Optional<UInt64> lastSlot = signingHistory.signedBlocks.stream().map(SignedBlock::getSlot).filter(Objects::nonNull).max(UInt64::compareTo);
    final Optional<UInt64> sourceEpoch = signingHistory.signedAttestations.stream().map(SignedAttestation::getSourceEpoch).filter(Objects::nonNull).max(UInt64::compareTo);
    final Optional<UInt64> targetEpoch = signingHistory.signedAttestations.stream().map(SignedAttestation::getTargetEpoch).filter(Objects::nonNull).max(UInt64::compareTo);
    final ValidatorSigningRecord record = new ValidatorSigningRecord(metadata.genesisValidatorsRoot, lastSlot.orElse(UInt64.ZERO), sourceEpoch.orElse(ValidatorSigningRecord.NEVER_SIGNED), targetEpoch.orElse(ValidatorSigningRecord.NEVER_SIGNED));
    return new SigningHistory(signingHistory.pubkey, record);
}
Also used : SigningHistory(tech.pegasys.teku.data.slashinginterchange.SigningHistory) ValidatorSigningRecord(tech.pegasys.teku.data.signingrecord.ValidatorSigningRecord) SignedAttestation(tech.pegasys.teku.data.slashinginterchange.SignedAttestation) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) SignedBlock(tech.pegasys.teku.data.slashinginterchange.SignedBlock)

Aggregations

ValidatorSigningRecord (tech.pegasys.teku.data.signingrecord.ValidatorSigningRecord)1 SignedAttestation (tech.pegasys.teku.data.slashinginterchange.SignedAttestation)1 SignedBlock (tech.pegasys.teku.data.slashinginterchange.SignedBlock)1 SigningHistory (tech.pegasys.teku.data.slashinginterchange.SigningHistory)1 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)1