From fd5e32a458e26d58332f4747a6b1826e5cb1ac07 Mon Sep 17 00:00:00 2001 From: Liang Ma Date: Thu, 20 Jun 2019 21:21:15 +0100 Subject: [PATCH] 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. --- miner/worker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index 4a9528c395..e700afeef3 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -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) } - interrupt = new(int32) w.newWorkCh <- &newWorkReq{interrupt: interrupt, noempty: noempty, timestamp: timestamp} timer.Reset(recommit) atomic.StoreInt32(&w.newTxs, 0)