diff --git a/beacon_node/lighthouse_network/src/types/globals.rs b/beacon_node/lighthouse_network/src/types/globals.rs index c439583d55..c64ee2bc73 100644 --- a/beacon_node/lighthouse_network/src/types/globals.rs +++ b/beacon_node/lighthouse_network/src/types/globals.rs @@ -80,7 +80,6 @@ impl NetworkGlobals { /// Returns the local ENR from the underlying Discv5 behaviour that external peers may connect /// to. - /// TODO: This contains duplicate metadata. Test who is consuming this method pub fn local_enr(&self) -> Enr { self.local_enr.read().enr().clone() } @@ -95,8 +94,8 @@ impl NetworkGlobals { *self.peer_id.read() } - // TODO: Must keep consistency between the persisted `local_enr` and the return of this - // function. Otherwise peers may downscore us and the network will have issues. + // Returns MetaData based on the cached local ENR fields. Local ENR from discv5 is the source of + // truth for the announced CGC value and the attnets and syncnets bitfields. pub fn local_metadata(&self) -> MetaData { self.local_enr.read().metadata().clone() } diff --git a/beacon_node/network/src/service.rs b/beacon_node/network/src/service.rs index 9f98cda6e8..26e5135eb9 100644 --- a/beacon_node/network/src/service.rs +++ b/beacon_node/network/src/service.rs @@ -297,6 +297,11 @@ impl NetworkService { .copied() .collect::>(); + // For each CGC value compares if the set of custody groups are compatible. + // For example: if this DB was synced for a supernode under PeerID A, there's a + // single CGC step of number_of_custody_groups and the set of custody groups = all + // the custody groups. If this node starts with a new PeerID B, the set of custody + // groups will still = all custody groups so both sets are compatible. if !custody_groups_disk.is_superset(&custody_groups_now) { let error_message = format!( "Incompatible database with current PeerID and config.