Skip to content

Commit a852031

Browse files
authored
Revert "eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)"
This reverts commit 57feabe.
1 parent efee853 commit a852031

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

eth/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs,
342342
} else {
343343
blockRlp = fmt.Sprintf("0x%x", rlpBytes)
344344
}
345-
if blockJSON, err = ethapi.RPCMarshalBlock(block, true, true, api.eth.engine); err != nil {
345+
if blockJSON, err = ethapi.RPCMarshalBlock(block, true, true); err != nil {
346346
blockJSON = map[string]interface{}{"error": err.Error()}
347347
}
348348
results = append(results, &BadBlockArgs{

internal/ethapi/api.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"github.com/ethereum/go-ethereum/common"
3333
"github.com/ethereum/go-ethereum/common/hexutil"
3434
"github.com/ethereum/go-ethereum/common/math"
35-
"github.com/ethereum/go-ethereum/consensus"
3635
"github.com/ethereum/go-ethereum/consensus/clique"
3736
"github.com/ethereum/go-ethereum/consensus/ethash"
3837
"github.com/ethereum/go-ethereum/consensus/misc"
@@ -1176,8 +1175,7 @@ func FormatLogs(logs []vm.StructLog) []StructLogRes {
11761175
}
11771176

11781177
// RPCMarshalHeader converts the given header to the RPC output .
1179-
func RPCMarshalHeader(head *types.Header, engine consensus.Engine) map[string]interface{} {
1180-
miner, _ := engine.Author(head)
1178+
func RPCMarshalHeader(head *types.Header) map[string]interface{} {
11811179
result := map[string]interface{}{
11821180
"number": (*hexutil.Big)(head.Number),
11831181
"hash": head.Hash(),
@@ -1187,7 +1185,7 @@ func RPCMarshalHeader(head *types.Header, engine consensus.Engine) map[string]in
11871185
"sha3Uncles": head.UncleHash,
11881186
"logsBloom": head.Bloom,
11891187
"stateRoot": head.Root,
1190-
"miner": miner,
1188+
"miner": head.Coinbase,
11911189
"difficulty": (*hexutil.Big)(head.Difficulty),
11921190
"extraData": hexutil.Bytes(head.Extra),
11931191
"size": hexutil.Uint64(head.Size()),
@@ -1208,8 +1206,8 @@ func RPCMarshalHeader(head *types.Header, engine consensus.Engine) map[string]in
12081206
// RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are
12091207
// returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain
12101208
// transaction hashes.
1211-
func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, engine consensus.Engine) (map[string]interface{}, error) {
1212-
fields := RPCMarshalHeader(block.Header(), engine)
1209+
func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
1210+
fields := RPCMarshalHeader(block.Header())
12131211
fields["size"] = hexutil.Uint64(block.Size())
12141212

12151213
if inclTx {
@@ -1244,15 +1242,15 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, engine consen
12441242
// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field, which requires
12451243
// a `PublicBlockchainAPI`.
12461244
func (s *PublicBlockChainAPI) rpcMarshalHeader(ctx context.Context, header *types.Header) map[string]interface{} {
1247-
fields := RPCMarshalHeader(header, s.b.Engine())
1245+
fields := RPCMarshalHeader(header)
12481246
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(ctx, header.Hash()))
12491247
return fields
12501248
}
12511249

12521250
// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
12531251
// a `PublicBlockchainAPI`.
12541252
func (s *PublicBlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
1255-
fields, err := RPCMarshalBlock(b, inclTx, fullTx, s.b.Engine())
1253+
fields, err := RPCMarshalBlock(b, inclTx, fullTx)
12561254
if err != nil {
12571255
return nil, err
12581256
}

0 commit comments

Comments
 (0)