diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-03-04 03:16:55 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-03-04 03:16:55 +0800 |
commit | 988391fc37d54f8ca4e49a03bf5f6b240a3dfa33 (patch) | |
tree | a77ba7a10a45ecd04ed4dbdbb3a6b9f697077860 /miner/worker.go | |
parent | b1603f166e36de5959e780c8e8fc866ae3ceeca0 (diff) | |
parent | a75af474f71606ed4572db216d9440b7c14a8a37 (diff) | |
download | dexon-988391fc37d54f8ca4e49a03bf5f6b240a3dfa33.tar.gz dexon-988391fc37d54f8ca4e49a03bf5f6b240a3dfa33.tar.zst dexon-988391fc37d54f8ca4e49a03bf5f6b240a3dfa33.zip |
Merge pull request #409 from tgerring/jsonlogs
Updated JSON log events
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 { |