aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorledgerwatch <akhounov@gmail.com>2018-07-31 15:22:33 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-07-31 15:22:33 +0800
commit2fbc454355f6214aee6b9480819e1a4d65bb6fcf (patch)
tree8472b6509ae72e5a7991ba5c0fdc2ee3a467f1b0 /miner
parentd6efa691872efb723ea3177a92da9e9b31c34eba (diff)
downloaddexon-2fbc454355f6214aee6b9480819e1a4d65bb6fcf.tar
dexon-2fbc454355f6214aee6b9480819e1a4d65bb6fcf.tar.gz
dexon-2fbc454355f6214aee6b9480819e1a4d65bb6fcf.tar.bz2
dexon-2fbc454355f6214aee6b9480819e1a4d65bb6fcf.tar.lz
dexon-2fbc454355f6214aee6b9480819e1a4d65bb6fcf.tar.xz
dexon-2fbc454355f6214aee6b9480819e1a4d65bb6fcf.tar.zst
dexon-2fbc454355f6214aee6b9480819e1a4d65bb6fcf.zip
miner: fix state locking while writing to chain (issue #16933) (#17173)
Diffstat (limited to 'miner')
-rw-r--r--miner/worker.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/miner/worker.go b/miner/worker.go
index e4e42f877..34329f849 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -316,7 +316,9 @@ func (self *worker) wait() {
for _, log := range work.state.Logs() {
log.BlockHash = block.Hash()
}
+ self.currentMu.Lock()
stat, err := self.chain.WriteBlockWithState(block, work.receipts, work.state)
+ self.currentMu.Unlock()
if err != nil {
log.Error("Failed writing block to chain", "err", err)
continue