@@ -32,6 +32,7 @@ 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"
3536 "github.com/ethereum/go-ethereum/consensus/clique"
3637 "github.com/ethereum/go-ethereum/consensus/ethash"
3738 "github.com/ethereum/go-ethereum/consensus/misc"
@@ -1175,7 +1176,8 @@ func FormatLogs(logs []vm.StructLog) []StructLogRes {
11751176}
11761177
11771178// RPCMarshalHeader converts the given header to the RPC output .
1178- func RPCMarshalHeader (head * types.Header ) map [string ]interface {} {
1179+ func RPCMarshalHeader (head * types.Header , engine consensus.Engine ) map [string ]interface {} {
1180+ miner , _ := engine .Author (head )
11791181 result := map [string ]interface {}{
11801182 "number" : (* hexutil .Big )(head .Number ),
11811183 "hash" : head .Hash (),
@@ -1185,7 +1187,7 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
11851187 "sha3Uncles" : head .UncleHash ,
11861188 "logsBloom" : head .Bloom ,
11871189 "stateRoot" : head .Root ,
1188- "miner" : head . Coinbase ,
1190+ "miner" : miner ,
11891191 "difficulty" : (* hexutil .Big )(head .Difficulty ),
11901192 "extraData" : hexutil .Bytes (head .Extra ),
11911193 "size" : hexutil .Uint64 (head .Size ()),
@@ -1206,8 +1208,8 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
12061208// RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are
12071209// returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain
12081210// transaction hashes.
1209- func RPCMarshalBlock (block * types.Block , inclTx bool , fullTx bool ) (map [string ]interface {}, error ) {
1210- fields := RPCMarshalHeader (block .Header ())
1211+ func RPCMarshalBlock (block * types.Block , inclTx bool , fullTx bool , engine consensus. Engine ) (map [string ]interface {}, error ) {
1212+ fields := RPCMarshalHeader (block .Header (), engine )
12111213 fields ["size" ] = hexutil .Uint64 (block .Size ())
12121214
12131215 if inclTx {
@@ -1242,15 +1244,15 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]i
12421244// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field, which requires
12431245// a `PublicBlockchainAPI`.
12441246func (s * PublicBlockChainAPI ) rpcMarshalHeader (ctx context.Context , header * types.Header ) map [string ]interface {} {
1245- fields := RPCMarshalHeader (header )
1247+ fields := RPCMarshalHeader (header , s . b . Engine () )
12461248 fields ["totalDifficulty" ] = (* hexutil .Big )(s .b .GetTd (ctx , header .Hash ()))
12471249 return fields
12481250}
12491251
12501252// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
12511253// a `PublicBlockchainAPI`.
12521254func (s * PublicBlockChainAPI ) rpcMarshalBlock (ctx context.Context , b * types.Block , inclTx bool , fullTx bool ) (map [string ]interface {}, error ) {
1253- fields , err := RPCMarshalBlock (b , inclTx , fullTx )
1255+ fields , err := RPCMarshalBlock (b , inclTx , fullTx , s . b . Engine () )
12541256 if err != nil {
12551257 return nil , err
12561258 }
0 commit comments