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