Skip to content

Commit 7625b1a

Browse files
committed
ethstats: report block miner, gas limit and gas consumption
1 parent 61ccb43 commit 7625b1a

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

‎ethstats/ethstats.go‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,15 @@ func (s *Service) reportLatency(in *json.Decoder, out *json.Encoder) error {
292292

293293
// blockStats is the information to report about individual blocks.
294294
type blockStats struct {
295-
Number *big.Int `json:"number"`
296-
Hash common.Hash `json:"hash"`
297-
Diff string `json:"difficulty"`
298-
TotalDiff string `json:"totalDifficulty"`
299-
Txs txStats `json:"transactions"`
300-
Uncles uncleStats `json:"uncles"`
295+
Number *big.Int `json:"number"`
296+
Hash common.Hash `json:"hash"`
297+
Miner common.Address `json:"miner"`
298+
GasUsed *big.Int `json:"gasUsed"`
299+
GasLimit *big.Int `json:"gasLimit"`
300+
Diff string `json:"difficulty"`
301+
TotalDiff string `json:"totalDifficulty"`
302+
Txs txStats `json:"transactions"`
303+
Uncles uncleStats `json:"uncles"`
301304
}
302305

303306
// txStats is a custom wrapper around a transaction array to force serializing
@@ -351,6 +354,9 @@ func (s *Service) reportBlock(out *json.Encoder) error {
351354
"block": &blockStats{
352355
Number: head.Number,
353356
Hash: head.Hash(),
357+
Miner: head.Coinbase,
358+
GasUsed: new(big.Int).Set(head.GasUsed),
359+
GasLimit: new(big.Int).Set(head.GasLimit),
354360
Diff: head.Difficulty.String(),
355361
TotalDiff: td.String(),
356362
Txs: txs,

0 commit comments

Comments
 (0)