deep-mining-log: only track non-stale blocks

if you track stale blocks, then you quickly overflow your ring buffer in the local network case where you're mining every block and generating a lot of stales.
This commit is contained in:
Jason Carver 2015-05-26 18:54:56 -07:00
parent f1ce5877ba
commit 6019f1bb0a

View File

@ -248,12 +248,12 @@ func (self *worker) wait() {
canonBlock := self.chain.GetBlockByNumber(block.NumberU64()) canonBlock := self.chain.GetBlockByNumber(block.NumberU64())
if canonBlock != nil && canonBlock.Hash() != block.Hash() { if canonBlock != nil && canonBlock.Hash() != block.Hash() {
stale = "stale-" stale = "stale-"
} else {
self.current.localMinedBlocks = newLocalMinedBlock(block.Number().Uint64(), self.current.localMinedBlocks)
} }
glog.V(logger.Info).Infof("🔨 Mined %sblock #%v (%x)", stale, block.Number(), block.Hash().Bytes()[:4]) glog.V(logger.Info).Infof("🔨 Mined %sblock #%v (%x)", stale, block.Number(), block.Hash().Bytes()[:4])
self.current.localMinedBlocks = newLocalMinedBlock(block.Number().Uint64(), self.current.localMinedBlocks)
jsonlogger.LogJson(&logger.EthMinerNewBlock{ jsonlogger.LogJson(&logger.EthMinerNewBlock{
BlockHash: block.Hash().Hex(), BlockHash: block.Hash().Hex(),
BlockNumber: block.Number(), BlockNumber: block.Number(),