diff --git a/beacon-chain/rpc/eth/beacon/handlers_pool.go b/beacon-chain/rpc/eth/beacon/handlers_pool.go index 8b5c01642dc..9ece2336cc3 100644 --- a/beacon-chain/rpc/eth/beacon/handlers_pool.go +++ b/beacon-chain/rpc/eth/beacon/handlers_pool.go @@ -197,7 +197,16 @@ func (s *Server) SubmitAttestations(w http.ResponseWriter, r *http.Request) { var sourceAttestations []*structs.Attestation if err := json.Unmarshal(req.Data, &sourceAttestations); err != nil { - httputil.HandleError(w, fmt.Sprintf("Failed to unmarshal request: %v", err), http.StatusInternalServerError) + var singleAttestation *structs.Attestation + if err := json.Unmarshal(req.Data, &singleAttestation); err != nil { + httputil.HandleError(w, "Could not parse data into attestations: "+err.Error(), http.StatusBadRequest) + return + } + sourceAttestations = append(sourceAttestations, singleAttestation) + } + + if len(sourceAttestations) == 0 { + httputil.HandleError(w, "No data submitted", http.StatusBadRequest) return }