Skip to content

Commit

Permalink
Fix typo in gossipsub coreTopicsAtFork
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Dec 5, 2022
1 parent 2e565a8 commit 6bf2e62
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/beacon-node/src/network/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,13 @@ export class Network implements INetwork {

// Before fork transition
if (epoch === forkEpoch - FORK_EPOCH_LOOKAHEAD) {
this.logger.info("Subscribing gossip topics to next fork", {nextFork});
// Don't subscribe to new fork if the node is not subscribed to any topic
if (this.isSubscribedToGossipCoreTopics()) this.subscribeCoreTopicsAtFork(nextFork);
if (this.isSubscribedToGossipCoreTopics()) {
this.subscribeCoreTopicsAtFork(nextFork);
this.logger.info("Subscribing gossip topics before fork", {nextFork});
} else {
this.logger.info("Skipping subscribing gossip topics before fork", {nextFork});
}
this.attnetsService.subscribeSubnetsToNextFork(nextFork);
this.syncnetsService.subscribeSubnetsToNextFork(nextFork);
}
Expand Down Expand Up @@ -494,11 +498,11 @@ export class Network implements INetwork {

if (this.opts.subscribeAllSubnets) {
for (let subnet = 0; subnet < ATTESTATION_SUBNET_COUNT; subnet++) {
this.gossip.unsubscribeTopic({type: GossipType.beacon_attestation, fork, subnet});
topics.push({type: GossipType.beacon_attestation, subnet});
}
if (forkSeq >= ForkSeq.altair) {
for (let subnet = 0; subnet < SYNC_COMMITTEE_SUBNET_COUNT; subnet++) {
this.gossip.unsubscribeTopic({type: GossipType.sync_committee, fork, subnet});
topics.push({type: GossipType.sync_committee, subnet});
}
}
}
Expand Down

0 comments on commit 6bf2e62

Please sign in to comment.