Skip to content

Commit

Permalink
Remove old gossipsub topic weights when switching to a new fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Tumas committed Nov 21, 2024
1 parent 4fd152a commit 94f3a44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion p2p/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub enum ServiceInboundMessage<P: Preset> {
Unsubscribe(GossipTopic),
UnsubscribeFromForkTopicsExcept(ForkDigest),
UpdateEnrSubnet(Subnet, bool),
UpdateForkVersion(EnrForkId),
UpdateFork(EnrForkId),
UpdateGossipsubParameters(u64, Slot),
}

Expand Down
6 changes: 3 additions & 3 deletions p2p/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,7 @@ impl<P: Preset> Network<P> {

let new_enr_fork_id = Self::enr_fork_id(&self.controller, &self.fork_context, slot);

ServiceInboundMessage::UpdateForkVersion(new_enr_fork_id)
.send(&self.network_to_service_tx);
ServiceInboundMessage::UpdateFork(new_enr_fork_id).send(&self.network_to_service_tx);
}

// Subscribe to the topics of the next phase.
Expand Down Expand Up @@ -1894,8 +1893,9 @@ fn run_network_service<P: Preset>(
ServiceInboundMessage::UpdateEnrSubnet(subnet, advertise) => {
service.update_enr_subnet(subnet, advertise);
}
ServiceInboundMessage::UpdateForkVersion(enr_fork_id) => {
ServiceInboundMessage::UpdateFork(enr_fork_id) => {
service.update_fork_version(enr_fork_id);
service.remove_topic_weight_except(enr_fork_id.fork_digest);
}
ServiceInboundMessage::UpdateGossipsubParameters(active_validator_count, slot) => {
if let Err(error) = service.update_gossipsub_parameters(
Expand Down

0 comments on commit 94f3a44

Please sign in to comment.