diff --git a/consensus/istanbul/core/core.go b/consensus/istanbul/core/core.go index 76884d6c43..c4fd5501b9 100644 --- a/consensus/istanbul/core/core.go +++ b/consensus/istanbul/core/core.go @@ -166,7 +166,7 @@ func (c *core) IsProposer() bool { } func (c *core) IsCurrentProposal(blockHash common.Hash) bool { - return c.current.pendingRequest != nil && c.current.pendingRequest.Proposal.Hash() == blockHash + return c.current != nil && c.current.pendingRequest != nil && c.current.pendingRequest.Proposal.Hash() == blockHash } func (c *core) commit() { diff --git a/miner/worker.go b/miner/worker.go index 0d2eb420a1..93b897d269 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -605,7 +605,9 @@ func (w *worker) resultLoop() { allReceipts := mergeReceipts(work.receipts, work.privateReceipts) // Commit block and state to database. + w.mu.Lock() stat, err := w.chain.WriteBlockWithState(block, allReceipts, work.state, nil) + w.mu.Unlock() if err != nil { log.Error("Failed writWriteBlockAndStating block to chain", "err", err) continue