From ca40dbd8aa0e0c5276931d7d25fecd2678f60b8d Mon Sep 17 00:00:00 2001 From: Nguyen Sy Thanh Son Date: Wed, 10 Jul 2019 09:24:08 +0700 Subject: [PATCH] Concurrent read/write during contract deployment --- miner/worker.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/miner/worker.go b/miner/worker.go index 01f631fa03..602eb708d8 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -346,7 +346,11 @@ 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