forked from cerc-io/plugeth
miner: not call commitNewWork if it's a side block (#16751)
This commit is contained in:
parent
400332b99d
commit
0029a869f0
@ -297,7 +297,6 @@ func (self *worker) update() {
|
|||||||
|
|
||||||
func (self *worker) wait() {
|
func (self *worker) wait() {
|
||||||
for {
|
for {
|
||||||
mustCommitNewWork := true
|
|
||||||
for result := range self.recv {
|
for result := range self.recv {
|
||||||
atomic.AddInt32(&self.atWork, -1)
|
atomic.AddInt32(&self.atWork, -1)
|
||||||
|
|
||||||
@ -322,11 +321,6 @@ func (self *worker) wait() {
|
|||||||
log.Error("Failed writing block to chain", "err", err)
|
log.Error("Failed writing block to chain", "err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// check if canon block and write transactions
|
|
||||||
if stat == core.CanonStatTy {
|
|
||||||
// implicit by posting ChainHeadEvent
|
|
||||||
mustCommitNewWork = false
|
|
||||||
}
|
|
||||||
// Broadcast the block and announce chain insertion event
|
// Broadcast the block and announce chain insertion event
|
||||||
self.mux.Post(core.NewMinedBlockEvent{Block: block})
|
self.mux.Post(core.NewMinedBlockEvent{Block: block})
|
||||||
var (
|
var (
|
||||||
@ -341,10 +335,6 @@ func (self *worker) wait() {
|
|||||||
|
|
||||||
// Insert the block into the set of pending ones to wait for confirmations
|
// Insert the block into the set of pending ones to wait for confirmations
|
||||||
self.unconfirmed.Insert(block.NumberU64(), block.Hash())
|
self.unconfirmed.Insert(block.NumberU64(), block.Hash())
|
||||||
|
|
||||||
if mustCommitNewWork {
|
|
||||||
self.commitNewWork()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user