@@ -67,9 +67,8 @@ type peerDataKey struct {
6767}
6868
6969type peerData struct {
70- pid string
71- mask map [uint64 ]bool
72- earliestAvailableSlot uint64
70+ pid string
71+ mask map [uint64 ]bool
7372}
7473
7574func (c * columnDataPeers ) refreshPeers (ctx context.Context ) {
@@ -106,46 +105,26 @@ func (c *columnDataPeers) refreshPeers(ctx context.Context) {
106105 log .Debug ("[peerSelector] empty cgc" , "peer" , pid )
107106 continue
108107 }
109- // request status
110- buf := new (bytes.Buffer )
111- forkDigest , err := c .ethClock .CurrentForkDigest ()
112- if err != nil {
113- log .Debug ("[peerSelector] failed to get fork digest" , "peer" , pid , "err" , err )
114- continue
115- }
116- myStatus := & cltypes.Status {
117- ForkDigest : forkDigest ,
118- FinalizedRoot : c .beaconState .FinalizedCheckpoint ().Root ,
119- FinalizedEpoch : c .beaconState .FinalizedCheckpoint ().Epoch ,
120- HeadRoot : c .beaconState .FinalizedCheckpoint ().Root ,
121- HeadSlot : c .beaconState .FinalizedCheckpoint ().Epoch * c .beaconConfig .SlotsPerEpoch ,
122- EarliestAvailableSlot : new (uint64 ),
123- }
124- if err := ssz_snappy .EncodeAndWrite (buf , myStatus ); err != nil {
125- log .Debug ("[peerSelector] failed to encode my status" , "peer" , pid , "err" , err )
126- continue
127- }
128- status := & cltypes.Status {}
129- if err := c .simpleReuqest (ctx , pid , communication .StatusProtocolV2 , status , buf .Bytes ()); err != nil {
130- log .Debug ("[peerSelector] failed to request peer status" , "peer" , pid , "err" , err )
131- continue
132- }
133- if status .EarliestAvailableSlot == nil {
134- log .Debug ("[peerSelector] empty earliest available slot" , "peer" , pid )
135- continue
108+ custodyIndices := map [cltypes.CustodyIndex ]bool {}
109+ if peer .EnodeId == "" {
110+ // fill all custody indices
111+ for i := cltypes .CustodyIndex (0 ); i < c .beaconConfig .NumberOfCustodyGroups ; i ++ {
112+ custodyIndices [i ] = true
113+ }
114+ } else {
115+ // get custody indices
116+ enodeId := enode .HexID (peer .EnodeId )
117+ custodyIndices , err = peerdasutils .GetCustodyColumns (enodeId , * metadata .CustodyGroupCount )
118+ if err != nil {
119+ log .Debug ("[peerSelector] failed to get custody indices" , "peer" , pid , "err" , err )
120+ continue
121+ }
136122 }
137123
138- // get custody indices
139- enodeId := enode .HexID (peer .EnodeId )
140- custodyIndices , err := peerdasutils .GetCustodyColumns (enodeId , * metadata .CustodyGroupCount )
141- if err != nil {
142- log .Debug ("[peerSelector] failed to get custody indices" , "peer" , pid , "err" , err )
143- continue
144- }
145- data := & peerData {pid : pid , mask : custodyIndices , earliestAvailableSlot : * status .EarliestAvailableSlot }
124+ data := & peerData {pid : pid , mask : custodyIndices }
146125 c .peerMetaCache .Add (peerKey , data )
147126 newPeers = append (newPeers , * data )
148- log .Debug ("[peerSelector] added peer" , "peer" , pid , "custodies" , len (custodyIndices ), "earliestAvailableSlot" , * status . EarliestAvailableSlot )
127+ log .Debug ("[peerSelector] added peer" , "peer" , pid , "custodies" , len (custodyIndices ))
149128 }
150129 c .peersMutex .Lock ()
151130 c .peersQueue = newPeers
0 commit comments