Search in sources :

Example 1 with SafeLookupResult

use of com.hedera.services.sigs.metadata.SafeLookupResult in project hedera-services by hashgraph.

the class DefaultTopicLookup method safeLookup.

@Override
public SafeLookupResult<TopicSigningMetadata> safeLookup(TopicID id) {
    var topic = topics.get().get(fromTopicId(id));
    if (topic == null || topic.isDeleted()) {
        return SafeLookupResult.failure(INVALID_TOPIC);
    } else {
        final var effAdminKey = topic.hasAdminKey() ? topic.getAdminKey() : null;
        final var effSubmitKey = topic.hasSubmitKey() ? topic.getSubmitKey() : null;
        return new SafeLookupResult<>(new TopicSigningMetadata(effAdminKey, effSubmitKey));
    }
}
Also used : TopicSigningMetadata(com.hedera.services.sigs.metadata.TopicSigningMetadata) SafeLookupResult(com.hedera.services.sigs.metadata.SafeLookupResult)

Aggregations

SafeLookupResult (com.hedera.services.sigs.metadata.SafeLookupResult)1 TopicSigningMetadata (com.hedera.services.sigs.metadata.TopicSigningMetadata)1