Skip to content

Commit

Permalink
Fix a deadlock around block 2.330.000... (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandrigin committed Apr 8, 2020
1 parent 57ea93f commit 0589f63
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/state/intra_block_state.go
Expand Up @@ -128,6 +128,11 @@ func (sdb *IntraBlockState) SetTrace(trace bool) {
func (sdb *IntraBlockState) setError(err error) {
sdb.Lock()
defer sdb.Unlock()
sdb.setErrorUnsafe(err)
}

// setErrorUnsafe sets error but should be called in medhods that already have locks
func (sdb *IntraBlockState) setErrorUnsafe(err error) {
if sdb.dbErr == nil {
sdb.dbErr = err
}
Expand Down Expand Up @@ -343,7 +348,7 @@ func (sdb *IntraBlockState) GetCodeSize(addr common.Address) int {
}
len, err := sdb.stateReader.ReadAccountCodeSize(addr, common.BytesToHash(stateObject.CodeHash()))
if err != nil {
sdb.setError(err)
sdb.setErrorUnsafe(err)
}
return len
}
Expand Down

0 comments on commit 0589f63

Please sign in to comment.