From c9471e778209e16442a530820fb90c01cd47c369 Mon Sep 17 00:00:00 2001
From: Nick Johnson <arachnid@notdot.net>
Date: Tue, 18 Oct 2016 21:34:37 +0100
Subject: [PATCH] miner: copy pending state before handing it to callers
 (#3162)

The pending state was not copied while not mining, leading to a data race.
---
 miner/worker.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/miner/worker.go b/miner/worker.go
index e5348cef4..89064c3b9 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -169,7 +169,7 @@ func (self *worker) pending() (*types.Block, *state.StateDB) {
 			self.current.txs,
 			nil,
 			self.current.receipts,
-		), self.current.state
+		), self.current.state.Copy()
 	}
 	return self.current.Block, self.current.state.Copy()
 }
-- 
GitLab