Commit 2fbc4543 authored by ledgerwatch's avatar ledgerwatch Committed by Péter Szilágyi

miner: fix state locking while writing to chain (issue #16933) (#17173)

parent d6efa691
...@@ -316,7 +316,9 @@ func (self *worker) wait() { ...@@ -316,7 +316,9 @@ func (self *worker) wait() {
for _, log := range work.state.Logs() { for _, log := range work.state.Logs() {
log.BlockHash = block.Hash() log.BlockHash = block.Hash()
} }
self.currentMu.Lock()
stat, err := self.chain.WriteBlockWithState(block, work.receipts, work.state) stat, err := self.chain.WriteBlockWithState(block, work.receipts, work.state)
self.currentMu.Unlock()
if err != nil { if err != nil {
log.Error("Failed writing block to chain", "err", err) log.Error("Failed writing block to chain", "err", err)
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment