aboutsummaryrefslogtreecommitdiffstats
path: root/ethstats/ethstats.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-04-12 21:38:31 +0800
committerGitHub <noreply@github.com>2017-04-12 21:38:31 +0800
commita7b9e484d05ceb0afce4ba5dbc62b8f262c2e354 (patch)
tree35ab50c0e276beb15e6beac2eaa846f6b737f64c /ethstats/ethstats.go
parent6b7ae4e751dbaee0f31032f045fd35b0c1079388 (diff)
downloaddexon-a7b9e484d05ceb0afce4ba5dbc62b8f262c2e354.tar
dexon-a7b9e484d05ceb0afce4ba5dbc62b8f262c2e354.tar.gz
dexon-a7b9e484d05ceb0afce4ba5dbc62b8f262c2e354.tar.bz2
dexon-a7b9e484d05ceb0afce4ba5dbc62b8f262c2e354.tar.lz
dexon-a7b9e484d05ceb0afce4ba5dbc62b8f262c2e354.tar.xz
dexon-a7b9e484d05ceb0afce4ba5dbc62b8f262c2e354.tar.zst
dexon-a7b9e484d05ceb0afce4ba5dbc62b8f262c2e354.zip
consensus, core, ethstats: use engine specific block beneficiary (#14318)
* consensus, core, ethstats: use engine specific block beneficiary * core, eth, les, miner: use explicit beneficiary during mining
Diffstat (limited to 'ethstats/ethstats.go')
-rw-r--r--ethstats/ethstats.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go
index aec8eb8bf..c16163ace 100644
--- a/ethstats/ethstats.go
+++ b/ethstats/ethstats.go
@@ -30,6 +30,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
@@ -54,6 +55,7 @@ type Service struct {
server *p2p.Server // Peer-to-peer server to retrieve networking infos
eth *eth.Ethereum // Full Ethereum service if monitoring a full node
les *les.LightEthereum // Light Ethereum service if monitoring a light node
+ engine consensus.Engine // Consensus engine to retrieve variadic block fields
node string // Name of the node to display on the monitoring page
pass string // Password to authorize access to the monitoring page
@@ -72,9 +74,16 @@ func New(url string, ethServ *eth.Ethereum, lesServ *les.LightEthereum) (*Servic
return nil, fmt.Errorf("invalid netstats url: \"%s\", should be nodename:secret@host:port", url)
}
// Assemble and return the stats service
+ var engine consensus.Engine
+ if ethServ != nil {
+ engine = ethServ.Engine()
+ } else {
+ engine = lesServ.Engine()
+ }
return &Service{
eth: ethServ,
les: lesServ,
+ engine: engine,
node: parts[1],
pass: parts[3],
host: parts[4],
@@ -493,12 +502,14 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
td = s.les.BlockChain().GetTd(header.Hash(), header.Number.Uint64())
}
// Assemble and return the block stats
+ author, _ := s.engine.Author(header)
+
return &blockStats{
Number: header.Number,
Hash: header.Hash(),
ParentHash: header.ParentHash,
Timestamp: header.Time,
- Miner: header.Coinbase,
+ Miner: author,
GasUsed: new(big.Int).Set(header.GasUsed),
GasLimit: new(big.Int).Set(header.GasLimit),
Diff: header.Difficulty.String(),