Browse Source

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.
Jason Carver 10 years ago
parent
commit
6019f1bb0a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      miner/worker.go

+ 2 - 2
miner/worker.go

@@ -248,12 +248,12 @@ func (self *worker) wait() {
 				canonBlock := self.chain.GetBlockByNumber(block.NumberU64())
 				if canonBlock != nil && canonBlock.Hash() != block.Hash() {
 					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])
 
-				self.current.localMinedBlocks = newLocalMinedBlock(block.Number().Uint64(), self.current.localMinedBlocks)
-
 				jsonlogger.LogJson(&logger.EthMinerNewBlock{
 					BlockHash:     block.Hash().Hex(),
 					BlockNumber:   block.Number(),