@@ -32,6 +32,7 @@ import (
32
32
"github.com/ethereum/go-ethereum/common"
33
33
"github.com/ethereum/go-ethereum/common/hexutil"
34
34
"github.com/ethereum/go-ethereum/common/math"
35
+ "github.com/ethereum/go-ethereum/consensus"
35
36
"github.com/ethereum/go-ethereum/consensus/clique"
36
37
"github.com/ethereum/go-ethereum/consensus/ethash"
37
38
"github.com/ethereum/go-ethereum/consensus/misc"
@@ -1175,7 +1176,8 @@ func FormatLogs(logs []vm.StructLog) []StructLogRes {
1175
1176
}
1176
1177
1177
1178
// 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 )
1179
1181
result := map [string ]interface {}{
1180
1182
"number" : (* hexutil .Big )(head .Number ),
1181
1183
"hash" : head .Hash (),
@@ -1185,7 +1187,7 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
1185
1187
"sha3Uncles" : head .UncleHash ,
1186
1188
"logsBloom" : head .Bloom ,
1187
1189
"stateRoot" : head .Root ,
1188
- "miner" : head . Coinbase ,
1190
+ "miner" : miner ,
1189
1191
"difficulty" : (* hexutil .Big )(head .Difficulty ),
1190
1192
"extraData" : hexutil .Bytes (head .Extra ),
1191
1193
"size" : hexutil .Uint64 (head .Size ()),
@@ -1206,8 +1208,8 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
1206
1208
// RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are
1207
1209
// returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain
1208
1210
// 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 )
1211
1213
fields ["size" ] = hexutil .Uint64 (block .Size ())
1212
1214
1213
1215
if inclTx {
@@ -1242,15 +1244,15 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]i
1242
1244
// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field, which requires
1243
1245
// a `PublicBlockchainAPI`.
1244
1246
func (s * PublicBlockChainAPI ) rpcMarshalHeader (ctx context.Context , header * types.Header ) map [string ]interface {} {
1245
- fields := RPCMarshalHeader (header )
1247
+ fields := RPCMarshalHeader (header , s . b . Engine () )
1246
1248
fields ["totalDifficulty" ] = (* hexutil .Big )(s .b .GetTd (ctx , header .Hash ()))
1247
1249
return fields
1248
1250
}
1249
1251
1250
1252
// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
1251
1253
// a `PublicBlockchainAPI`.
1252
1254
func (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 () )
1254
1256
if err != nil {
1255
1257
return nil , err
1256
1258
}
0 commit comments