miner: minor fix for the interrupt memory allocation

if the interrupt pointer is NULL then allocate memory for it.
if the intterupt point is not NULL then reuse original one.
This commit is contained in:
Liang Ma 2019-06-20 21:21:15 +01:00
parent 25c3282cf1
commit fd5e32a458

View file

@ -299,8 +299,9 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
commit := func(noempty bool, s int32) {
if interrupt != nil {
atomic.StoreInt32(interrupt, s)
}
} else {
interrupt = new(int32)
}
w.newWorkCh <- &newWorkReq{interrupt: interrupt, noempty: noempty, timestamp: timestamp}
timer.Reset(recommit)
atomic.StoreInt32(&w.newTxs, 0)