Search in sources :

Example 1 with PostProcessorException

use of com.radixdlt.engine.PostProcessorException in project radixdlt by radixdlt.

the class CandidateForkVotesPostProcessor method extractBftNodeAndVoteIfPresent.

private Optional<Pair<BFTNode, CandidateForkVote>> extractBftNodeAndVoteIfPresent(RawSubstateBytes rawSubstateBytes) {
    try {
        final var validatorSystemMetadataSubstate = (ValidatorSystemMetadata) substateDeserialization.deserialize(rawSubstateBytes.getData());
        if (Bytes.isAllZeros(validatorSystemMetadataSubstate.data())) {
            return Optional.empty();
        }
        final var candidateForkVote = new CandidateForkVote(HashCode.fromBytes(validatorSystemMetadataSubstate.data()));
        return Optional.of(Pair.of(BFTNode.create(validatorSystemMetadataSubstate.validatorKey()), candidateForkVote));
    } catch (DeserializeException e) {
        throw new PostProcessorException("Error deserializing ValidatorSystemMetadata");
    }
}
Also used : ValidatorSystemMetadata(com.radixdlt.application.validators.state.ValidatorSystemMetadata) DeserializeException(com.radixdlt.serialization.DeserializeException) CandidateForkVote(com.radixdlt.statecomputer.forks.CandidateForkVote) PostProcessorException(com.radixdlt.engine.PostProcessorException)

Aggregations

ValidatorSystemMetadata (com.radixdlt.application.validators.state.ValidatorSystemMetadata)1 PostProcessorException (com.radixdlt.engine.PostProcessorException)1 DeserializeException (com.radixdlt.serialization.DeserializeException)1 CandidateForkVote (com.radixdlt.statecomputer.forks.CandidateForkVote)1