aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-03 14:52:20 +0800
committerzelig <viktor.tron@gmail.com>2015-03-03 14:52:20 +0800
commit34be795bc11e72092460401d015852d61c769509 (patch)
treeeb6705128a4e0f6cd649b0171a68445290afe291 /miner
parent65cad14f9b27db396d036f47814d4843d947ac43 (diff)
parenta75af474f71606ed4572db216d9440b7c14a8a37 (diff)
downloaddexon-34be795bc11e72092460401d015852d61c769509.tar
dexon-34be795bc11e72092460401d015852d61c769509.tar.gz
dexon-34be795bc11e72092460401d015852d61c769509.tar.bz2
dexon-34be795bc11e72092460401d015852d61c769509.tar.lz
dexon-34be795bc11e72092460401d015852d61c769509.tar.xz
dexon-34be795bc11e72092460401d015852d61c769509.tar.zst
dexon-34be795bc11e72092460401d015852d61c769509.zip
Merge remote-tracking branch 'tgerring/jsonlogs' into jsonlogs
Diffstat (limited to 'miner')
-rw-r--r--miner/worker.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/miner/worker.go b/miner/worker.go
index afce68c35..bc1c8e194 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -11,11 +11,14 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/state"
"gopkg.in/fatih/set.v0"
)
+var jsonlogger = logger.NewJsonLogger()
+
type environment struct {
totalUsedGas *big.Int
state *state.StateDB
@@ -146,7 +149,12 @@ func (self *worker) wait() {
block := self.current.block
if block.Number().Uint64() == work.Number && block.Nonce() == nil {
self.current.block.Header().Nonce = work.Nonce
-
+ jsonlogger.LogJson(&logger.EthMinerNewBlock{
+ BlockHash: ethutil.Bytes2Hex(block.Hash()),
+ BlockNumber: block.Number(),
+ ChainHeadHash: ethutil.Bytes2Hex(block.ParentHeaderHash),
+ BlockPrevHash: ethutil.Bytes2Hex(block.ParentHeaderHash),
+ })
if err := self.chain.InsertChain(types.Blocks{self.current.block}); err == nil {
self.mux.Post(core.NewMinedBlockEvent{self.current.block})
} else {