diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-04 03:30:05 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-04 03:30:05 +0800 |
commit | f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207 (patch) | |
tree | b54c28e87d0a64cab079c08108672b8d7e39d5f2 /miner/worker.go | |
parent | 27078919669ad99bfb51b468f7c475120e6e148a (diff) | |
parent | 6c2856df2335dec946a5ebc14a4438b261e0c881 (diff) | |
download | go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar.gz go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar.zst go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.zip |
Merge branch 'jsonlogs' of https://github.com/ethersphere/go-ethereum into ethersphere-jsonlogs
Conflicts:
eth/block_pool.go
eth/block_pool_test.go
eth/protocol_test.go
miner/worker.go
Diffstat (limited to 'miner/worker.go')
-rw-r--r-- | miner/worker.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/miner/worker.go b/miner/worker.go index 012353fa1..1388b22b0 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 @@ -152,6 +155,13 @@ func (self *worker) wait() { self.current.block.Header().MixDigest = work.MixDigest self.current.block.Header().SeedHash = work.SeedHash + 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}) fmt.Println("GOOD BLOCK", self.current.block) |