@@ -2,6 +2,7 @@ package sync
22
33import (
44 "context"
5+ "slices"
56 "time"
67
78 libp2pcore "github.com/libp2p/go-libp2p/core"
@@ -19,7 +20,7 @@ import (
1920 "github.com/sirupsen/logrus"
2021)
2122
22- func (s * Service ) streamDataColumnBatch (ctx context.Context , batch blockBatch , wQuota uint64 , wantedDataColumnIndices map [ uint64 ] bool , stream libp2pcore.Stream ) (uint64 , error ) {
23+ func (s * Service ) streamDataColumnBatch (ctx context.Context , batch blockBatch , wQuota uint64 , wantedDataColumnIndices [] uint64 , stream libp2pcore.Stream ) (uint64 , error ) {
2324 _ , span := trace .StartSpan (ctx , "sync.streamDataColumnBatch" )
2425 defer span .End ()
2526
@@ -40,7 +41,7 @@ func (s *Service) streamDataColumnBatch(ctx context.Context, batch blockBatch, w
4041 return wQuota , errors .Wrapf (err , "could not retrieve data columns indice for block root %#x" , blockRoot )
4142 }
4243
43- for dataColumnIndex := range wantedDataColumnIndices {
44+ for _ , dataColumnIndex := range wantedDataColumnIndices {
4445 isDataColumnStored := storedDataColumnsIndices [dataColumnIndex ]
4546
4647 // Skip if the data column is not stored.
@@ -157,10 +158,11 @@ func (s *Service) dataColumnSidecarsByRangeRPCHandler(ctx context.Context, msg i
157158 }
158159
159160 // Derive the wanted columns for the request.
160- wantedColumns := make (map [uint64 ]bool , len (r .Columns ))
161- for _ , c := range r .Columns {
162- wantedColumns [c ] = true
163- }
161+ wantedColumns := make ([]uint64 , len (r .Columns ))
162+ copy (wantedColumns , r .Columns )
163+
164+ // Sort the wanted columns.
165+ slices.Sort [[]uint64 ](wantedColumns )
164166
165167 var batch blockBatch
166168 wQuota := params .BeaconConfig ().MaxRequestDataColumnSidecars
0 commit comments