From 30293497617b19a2f55633ac0680fbe2234607e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= <peterke@gmail.com>
Date: Mon, 20 Jul 2015 14:37:43 +0300
Subject: [PATCH] miner: fix current work data race

---
 miner/worker.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/miner/worker.go b/miner/worker.go
index 90ef79e3f..a4ebe6fe7 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -160,6 +160,7 @@ func (self *worker) pendingState() *state.StateDB {
 func (self *worker) pendingBlock() *types.Block {
 	self.currentMu.Lock()
 	defer self.currentMu.Unlock()
+
 	if atomic.LoadInt32(&self.mining) == 0 {
 		return types.NewBlock(
 			self.current.header,
@@ -228,9 +229,9 @@ out:
 			case core.TxPreEvent:
 				// Apply transaction to the pending state if we're not mining
 				if atomic.LoadInt32(&self.mining) == 0 {
-					self.mu.Lock()
+					self.currentMu.Lock()
 					self.current.commitTransactions(types.Transactions{ev.Tx}, self.gasPrice, self.proc)
-					self.mu.Unlock()
+					self.currentMu.Unlock()
 				}
 			}
 		case <-self.quit:
-- 
GitLab