Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
fixed deadlock (erigontech#4633)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 committed Jul 5, 2022
1 parent d83b7a4 commit a76e6a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions turbo/stages/headerdownload/header_algos.go
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,10 @@ func (hd *HeaderDownload) ValidatePayload(tx kv.RwTx, header *types.Header, body
hd.nextForkState.UpdateTxn(tx)
}
hd.nextForkHash = header.Hash()
hd.lock.Unlock()
// Let's assemble the side fork chain if we have others building.
validationError = execPayload(hd.nextForkState, header, body, 0, nil, nil)
hd.lock.Lock()
if validationError != nil {
status = remote.EngineStatus_INVALID
if isAncestorPosBlock {
Expand Down Expand Up @@ -1182,7 +1184,9 @@ func (hd *HeaderDownload) ValidatePayload(tx kv.RwTx, header *types.Header, body
// if it is not canonical we validate it as a side fork.
batch := memdb.NewMemoryBatch(tx)
defer batch.Close()
hd.lock.Unlock()
validationError = execPayload(batch, header, body, unwindPoint, headersChain, bodiesChain)
hd.lock.Lock()
latestValidHash = header.Hash()
if validationError != nil {
if isAncestorPosBlock {
Expand Down

0 comments on commit a76e6a1

Please sign in to comment.