diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-03 14:52:20 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-03 14:52:20 +0800 |
commit | 34be795bc11e72092460401d015852d61c769509 (patch) | |
tree | eb6705128a4e0f6cd649b0171a68445290afe291 /miner/worker.go | |
parent | 65cad14f9b27db396d036f47814d4843d947ac43 (diff) | |
parent | a75af474f71606ed4572db216d9440b7c14a8a37 (diff) | |
download | go-tangerine-34be795bc11e72092460401d015852d61c769509.tar go-tangerine-34be795bc11e72092460401d015852d61c769509.tar.gz go-tangerine-34be795bc11e72092460401d015852d61c769509.tar.bz2 go-tangerine-34be795bc11e72092460401d015852d61c769509.tar.lz go-tangerine-34be795bc11e72092460401d015852d61c769509.tar.xz go-tangerine-34be795bc11e72092460401d015852d61c769509.tar.zst go-tangerine-34be795bc11e72092460401d015852d61c769509.zip |
Merge remote-tracking branch 'tgerring/jsonlogs' into jsonlogs
Diffstat (limited to 'miner/worker.go')
-rw-r--r-- | miner/worker.go | 10 |
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 { |