miner: stale block notification

This commit is contained in:
obscuren 2015-05-17 17:51:34 +02:00
parent c67424ecc8
commit bc5e60cd63
1 changed files with 7 additions and 1 deletions

View File

@ -224,7 +224,13 @@ func (self *worker) wait() {
}
self.mux.Post(core.NewMinedBlockEvent{block})
glog.V(logger.Info).Infof("🔨 Mined block #%v", block.Number())
var stale string
canonBlock := self.chain.GetBlockByNumber(block.NumberU64())
if canonBlock != nil && canonBlock.Hash() != block.Hash() {
stale = "stale-"
}
glog.V(logger.Info).Infof("🔨 Mined %sblock #%v (%x)", stale, block.Number(), block.Hash().Bytes()[:4])
jsonlogger.LogJson(&logger.EthMinerNewBlock{
BlockHash: block.Hash().Hex(),