diff --git a/beacon-chain/rpc/eth/beacon/handlers.go b/beacon-chain/rpc/eth/beacon/handlers.go index 1eb21b2a2..c8d941815 100644 --- a/beacon-chain/rpc/eth/beacon/handlers.go +++ b/beacon-chain/rpc/eth/beacon/handlers.go @@ -861,12 +861,12 @@ func (s *Server) GetBlockHeader(w http.ResponseWriter, r *http.Request) { if !ok { return } - header, err := blk.Header() + blockHeader, err := blk.Header() if err != nil { http2.HandleError(w, "Could not get block header: %s"+err.Error(), http.StatusInternalServerError) return } - headerRoot, err := header.HashTreeRoot() + headerRoot, err := blockHeader.Header.HashTreeRoot() if err != nil { http2.HandleError(w, "Could not hash block header: %s"+err.Error(), http.StatusInternalServerError) return @@ -892,8 +892,8 @@ func (s *Server) GetBlockHeader(w http.ResponseWriter, r *http.Request) { Root: hexutil.Encode(headerRoot[:]), Canonical: canonical, Header: &shared.SignedBeaconBlockHeader{ - Message: shared.BeaconBlockHeaderFromConsensus(header.Header), - Signature: hexutil.Encode(header.Signature), + Message: shared.BeaconBlockHeaderFromConsensus(blockHeader.Header), + Signature: hexutil.Encode(blockHeader.Signature), }, }, ExecutionOptimistic: isOptimistic, diff --git a/beacon-chain/rpc/eth/beacon/handlers_test.go b/beacon-chain/rpc/eth/beacon/handlers_test.go index dbdaaa979..45478f073 100644 --- a/beacon-chain/rpc/eth/beacon/handlers_test.go +++ b/beacon-chain/rpc/eth/beacon/handlers_test.go @@ -1376,7 +1376,7 @@ func TestServer_GetBlockHeader(t *testing.T) { resp := &GetBlockHeaderResponse{} require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp)) assert.Equal(t, true, resp.Data.Canonical) - assert.Equal(t, "0x725b389a0e5a7623fa7600b9e5cb6248d5c293fc2f5877e42a665b44f40c85f6", resp.Data.Root) + assert.Equal(t, "0xd7d92f6206707f2c9c4e7e82320617d5abac2b6461a65ea5bb1a154b5b5ea2fa", resp.Data.Root) assert.Equal(t, "0x736967000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", resp.Data.Header.Signature) assert.Equal(t, "123", resp.Data.Header.Message.Slot) assert.Equal(t, "0x706172656e74726f6f7400000000000000000000000000000000000000000000", resp.Data.Header.Message.ParentRoot)