Skip to content

Commit

Permalink
miner: prevent datarace, fixes ethereum#24299
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Jan 27, 2022
1 parent e282246 commit 5e3af9e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,9 @@ func (w *worker) resultLoop() {
logs = append(logs, receipt.Logs...)
}
// Commit block and state to database.
w.snapshotMu.RLock()
_, err := w.chain.WriteBlockAndSetHead(block, receipts, logs, task.state, true)
w.snapshotMu.RUnlock()
if err != nil {
log.Error("Failed writing block to chain", "err", err)
continue
Expand Down

0 comments on commit 5e3af9e

Please sign in to comment.