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);
}
Aggregations