Skip to content

Commit

Permalink
Tiny getTopic optimization (#8776)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr authored Oct 24, 2024
1 parent a5b7a22 commit 56440a8
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public class Eth2TopicHandler<MessageT extends SszData> implements TopicHandler
private final OperationProcessor<MessageT> processor;
private final GossipEncoding gossipEncoding;
private final Bytes4 forkDigest;
private final String topicName;
private final SszSchema<MessageT> messageType;
private final Eth2PreparedGossipMessageFactory preparedGossipMessageFactory;
private final OperationMilestoneValidator<MessageT> forkValidator;
private final NetworkingSpecConfig networkingConfig;
private final DebugDataDumper debugDataDumper;
private final String topic;

public Eth2TopicHandler(
final RecentChainData recentChainData,
Expand All @@ -72,14 +72,14 @@ public Eth2TopicHandler(
this.processor = processor;
this.gossipEncoding = gossipEncoding;
this.forkDigest = forkDigest;
this.topicName = topicName;
this.messageType = messageType;
this.forkValidator = forkValidator;
this.networkingConfig = networkingConfig;
this.preparedGossipMessageFactory =
gossipEncoding.createPreparedGossipMessageFactory(
recentChainData::getMilestoneByForkDigest);
this.debugDataDumper = debugDataDumper;
this.topic = GossipTopics.getTopic(forkDigest, topicName, gossipEncoding);
}

public Eth2TopicHandler(
Expand Down Expand Up @@ -159,10 +159,6 @@ private void processMessage(
}
}

private String getTopicName() {
return topicName;
}

private SszSchema<MessageT> getMessageType() {
return messageType;
}
Expand Down Expand Up @@ -214,7 +210,7 @@ public OperationProcessor<MessageT> getProcessor() {
}

public String getTopic() {
return GossipTopics.getTopic(getForkDigest(), getTopicName(), getGossipEncoding());
return topic;
}

public GossipEncoding getGossipEncoding() {
Expand Down

0 comments on commit 56440a8

Please sign in to comment.