mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Fix bug in Beacon API getBlobs (#13100)
Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
This commit is contained in:
parent
cbf6a2752d
commit
671bf00c98
@ -85,7 +85,7 @@ func (s *Server) Blobs(w http.ResponseWriter, r *http.Request) {
|
||||
http2.HandleError(w, errors.Wrapf(err, "could not retrieve blobs for slot %d", slot).Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http2.WriteJson(w, buildSidecardsResponse(sidecars))
|
||||
http2.WriteJson(w, buildSidecarsResponse(sidecars))
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -116,7 +116,7 @@ func (s *Server) Blobs(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
http2.WriteJson(w, buildSidecardsResponse(sidecars))
|
||||
http2.WriteJson(w, buildSidecarsResponse(sidecars))
|
||||
}
|
||||
|
||||
// parseIndices filters out invalid and duplicate blob indices
|
||||
@ -129,8 +129,11 @@ loop:
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if ix >= field_params.MaxBlobsPerBlock {
|
||||
continue
|
||||
}
|
||||
for i := range indices {
|
||||
if ix == indices[i] || ix >= field_params.MaxBlobsPerBlock {
|
||||
if ix == indices[i] {
|
||||
continue loop
|
||||
}
|
||||
}
|
||||
@ -139,7 +142,7 @@ loop:
|
||||
return indices
|
||||
}
|
||||
|
||||
func buildSidecardsResponse(sidecars []*eth.BlobSidecar) *SidecarsResponse {
|
||||
func buildSidecarsResponse(sidecars []*eth.BlobSidecar) *SidecarsResponse {
|
||||
resp := &SidecarsResponse{Data: make([]*Sidecar, len(sidecars))}
|
||||
for i, sc := range sidecars {
|
||||
resp.Data[i] = &Sidecar{
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
func TestParseIndices(t *testing.T) {
|
||||
assert.DeepEqual(t, []uint64{1, 2, 3}, parseIndices(&url.URL{RawQuery: "indices=1&indices=2&indices=foo&indices=1&indices=3&bar=bar"}))
|
||||
assert.DeepEqual(t, []uint64{1, 2, 3}, parseIndices(&url.URL{RawQuery: "indices=100&indices=1&indices=2&indices=foo&indices=1&indices=3&bar=bar"}))
|
||||
}
|
||||
|
||||
func TestBlobs(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user