diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-08-16 20:04:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-16 20:04:50 +0800 |
commit | 1d439b5e1017af7d94b8d199ef50463ba7e43d85 (patch) | |
tree | 182ab1a05aa8893917de39e81a11ae31d3cb5abf | |
parent | 54216811a05a78c6aef4d9f5d401eeb0ebac6a84 (diff) | |
parent | 62f5137a72c69ae8cffbc3526611af77448d25de (diff) | |
download | dexon-1d439b5e1017af7d94b8d199ef50463ba7e43d85.tar dexon-1d439b5e1017af7d94b8d199ef50463ba7e43d85.tar.gz dexon-1d439b5e1017af7d94b8d199ef50463ba7e43d85.tar.bz2 dexon-1d439b5e1017af7d94b8d199ef50463ba7e43d85.tar.lz dexon-1d439b5e1017af7d94b8d199ef50463ba7e43d85.tar.xz dexon-1d439b5e1017af7d94b8d199ef50463ba7e43d85.tar.zst dexon-1d439b5e1017af7d94b8d199ef50463ba7e43d85.zip |
Merge pull request #17416 from karalabe/miner-details
miner: add gas and fee details to mining logs
-rw-r--r-- | miner/worker.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/miner/worker.go b/miner/worker.go index 81a9eabfd..e7e279645 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -780,8 +780,16 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st select { case w.taskCh <- &task{receipts: receipts, state: s, block: block, createdAt: time.Now()}: w.unconfirmed.Shift(block.NumberU64() - 1) - log.Info("Commit new mining work", "number", block.Number(), "txs", w.current.tcount, "uncles", len(uncles), - "elapsed", common.PrettyDuration(time.Since(start))) + + feesWei := new(big.Int) + for _, tx := range block.Transactions() { + feesWei.Add(feesWei, new(big.Int).Mul(new(big.Int).SetUint64(tx.Gas()), tx.GasPrice())) + } + feesEth := new(big.Float).Quo(new(big.Float).SetInt(feesWei), new(big.Float).SetInt(big.NewInt(params.Ether))) + + log.Info("Commit new mining work", "number", block.Number(), "uncles", len(uncles), "txs", w.current.tcount, + "gas", block.GasUsed(), "fees", feesEth, "elapsed", common.PrettyDuration(time.Since(start))) + case <-w.exitCh: log.Info("Worker has exited") } |