aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-29 19:15:58 +0800
committerGitHub <noreply@github.com>2016-11-29 19:15:58 +0800
commit3807e520ec99dce5dc6ef28b237cd4be4a0992fe (patch)
tree59077e73baa04faa4a1d29fe5dbfa9c36c00fb1c
parent61ccb43487a1d751e20b39d8328cb00994cdf796 (diff)
parent7625b1a4f49812d2b504033148ddf3ed79900145 (diff)
downloaddexon-3807e520ec99dce5dc6ef28b237cd4be4a0992fe.tar
dexon-3807e520ec99dce5dc6ef28b237cd4be4a0992fe.tar.gz
dexon-3807e520ec99dce5dc6ef28b237cd4be4a0992fe.tar.bz2
dexon-3807e520ec99dce5dc6ef28b237cd4be4a0992fe.tar.lz
dexon-3807e520ec99dce5dc6ef28b237cd4be4a0992fe.tar.xz
dexon-3807e520ec99dce5dc6ef28b237cd4be4a0992fe.tar.zst
dexon-3807e520ec99dce5dc6ef28b237cd4be4a0992fe.zip
Merge pull request #3370 from karalabe/ethstats-block-fields
ethstats: report block miner, gas limit and gas consumption
-rw-r--r--ethstats/ethstats.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go
index dfbf855e6..4efa4a813 100644
--- a/ethstats/ethstats.go
+++ b/ethstats/ethstats.go
@@ -292,12 +292,15 @@ func (s *Service) reportLatency(in *json.Decoder, out *json.Encoder) error {
// blockStats is the information to report about individual blocks.
type blockStats struct {
- Number *big.Int `json:"number"`
- Hash common.Hash `json:"hash"`
- Diff string `json:"difficulty"`
- TotalDiff string `json:"totalDifficulty"`
- Txs txStats `json:"transactions"`
- Uncles uncleStats `json:"uncles"`
+ Number *big.Int `json:"number"`
+ Hash common.Hash `json:"hash"`
+ Miner common.Address `json:"miner"`
+ GasUsed *big.Int `json:"gasUsed"`
+ GasLimit *big.Int `json:"gasLimit"`
+ 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
@@ -351,6 +354,9 @@ func (s *Service) reportBlock(out *json.Encoder) error {
"block": &blockStats{
Number: head.Number,
Hash: head.Hash(),
+ Miner: head.Coinbase,
+ GasUsed: new(big.Int).Set(head.GasUsed),
+ GasLimit: new(big.Int).Set(head.GasLimit),
Diff: head.Difficulty.String(),
TotalDiff: td.String(),
Txs: txs,