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
This commit is contained in:
obscuren
2015-03-03 20:30:05 +01:00
6 changed files with 64 additions and 29 deletions

View File

@ -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)