Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dB2510 committed Feb 21, 2023
1 parent 8b402ac commit e2e1368
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions testutil/beaconmock/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,34 +105,21 @@ func newHTTPServer(addr string, optionalHandlers map[string]http.HandlerFunc, ov
},
"/eth/v2/beacon/blocks/{block_id}": func(w http.ResponseWriter, r *http.Request) {
type signedBlockResponseJSON struct {
Version eth2spec.DataVersion `json:"version"`
Version *eth2spec.DataVersion `json:"version"`
Data *bellatrix.SignedBeaconBlock `json:"data"`
}

version := eth2spec.DataVersionBellatrix
resp, err := json.Marshal(signedBlockResponseJSON{
Version: eth2spec.DataVersionBellatrix,
Data: testutil.RandomBellatrixSignedBeaconBlock(),
})
if err != nil {
panic(err) // This should never happen and this is test code sorry ;)
}

_, _ = w.Write(resp)
},
"/eth/v1/beacon/blocks/{block_id}": func(w http.ResponseWriter, r *http.Request) {
type signedBlockResponseJSON struct {
Version eth2spec.DataVersion `json:"version"`
Data *bellatrix.SignedBeaconBlock `json:"data"`
}

resp, err := json.Marshal(signedBlockResponseJSON{
Version: eth2spec.DataVersionBellatrix,
Version: &version,
Data: testutil.RandomBellatrixSignedBeaconBlock(),
})
if err != nil {
panic(err) // This should never happen and this is test code sorry ;)
}

w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = w.Write(resp)
},
}
Expand Down

0 comments on commit e2e1368

Please sign in to comment.