minor fix for chainHeadCh

This commit is contained in:
Tuna 2018-10-05 10:23:42 +07:00
parent 601e22c2fa
commit a8aead3957

View file

@ -482,9 +482,9 @@ func (self *worker) commitNewWork() {
L: L:
select { select {
case newBlock := <-self.chainHeadCh: case newBlock := <-self.chainHeadCh:
self.chainHeadCh <- newBlock
if newBlock.Block.NumberU64() > parent.NumberU64() { if newBlock.Block.NumberU64() > parent.NumberU64() {
log.Info("New block has came already. Skip this turn", "new block", newBlock.Block.NumberU64(), "current block", parent.NumberU64()) log.Info("New block has came already. Skip this turn", "new block", newBlock.Block.NumberU64(), "current block", parent.NumberU64())
self.chainHeadCh <- newBlock
return return
} }
case <-time.After(time.Duration(gap) * time.Second): case <-time.After(time.Duration(gap) * time.Second):