mirror of https://github.com/status-im/op-geth.git
ethstats: report block miner, gas limit and gas consumption
This commit is contained in:
parent
61ccb43487
commit
7625b1a4f4
|
@ -292,12 +292,15 @@ func (s *Service) reportLatency(in *json.Decoder, out *json.Encoder) error {
|
||||||
|
|
||||||
// blockStats is the information to report about individual blocks.
|
// blockStats is the information to report about individual blocks.
|
||||||
type blockStats struct {
|
type blockStats struct {
|
||||||
Number *big.Int `json:"number"`
|
Number *big.Int `json:"number"`
|
||||||
Hash common.Hash `json:"hash"`
|
Hash common.Hash `json:"hash"`
|
||||||
Diff string `json:"difficulty"`
|
Miner common.Address `json:"miner"`
|
||||||
TotalDiff string `json:"totalDifficulty"`
|
GasUsed *big.Int `json:"gasUsed"`
|
||||||
Txs txStats `json:"transactions"`
|
GasLimit *big.Int `json:"gasLimit"`
|
||||||
Uncles uncleStats `json:"uncles"`
|
Diff string `json:"difficulty"`
|
||||||
|
TotalDiff string `json:"totalDifficulty"`
|
||||||
|
Txs txStats `json:"transactions"`
|
||||||
|
Uncles uncleStats `json:"uncles"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// txStats is a custom wrapper around a transaction array to force serializing
|
// txStats is a custom wrapper around a transaction array to force serializing
|
||||||
|
@ -351,6 +354,9 @@ func (s *Service) reportBlock(out *json.Encoder) error {
|
||||||
"block": &blockStats{
|
"block": &blockStats{
|
||||||
Number: head.Number,
|
Number: head.Number,
|
||||||
Hash: head.Hash(),
|
Hash: head.Hash(),
|
||||||
|
Miner: head.Coinbase,
|
||||||
|
GasUsed: new(big.Int).Set(head.GasUsed),
|
||||||
|
GasLimit: new(big.Int).Set(head.GasLimit),
|
||||||
Diff: head.Difficulty.String(),
|
Diff: head.Difficulty.String(),
|
||||||
TotalDiff: td.String(),
|
TotalDiff: td.String(),
|
||||||
Txs: txs,
|
Txs: txs,
|
||||||
|
|
Loading…
Reference in New Issue