mirror of https://github.com/poanetwork/quorum.git
Merge pull request #684 from jbhurat/lock_writewithblockstate
Adding a lock around WriteBlockWithState while processing sealing result
This commit is contained in:
commit
89f811a6a6
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue