Skip to content

Commit

Permalink
core/rawdb: fix double-lock causing hang (ethereum#24189)
Browse files Browse the repository at this point in the history
Fixes ethereum#24159

Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
holiman and fjl authored Jan 4, 2022
1 parent d0bd501 commit 66a908c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,11 @@ func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue {
if len(data) > 0 {
return nil
}
// Get it by hash from leveldb
data, _ = db.Get(blockBodyKey(number, ReadCanonicalHash(db, number)))
// Block is not in ancients, read from leveldb by hash and number.
// Note: ReadCanonicalHash cannot be used here because it also
// calls ReadAncients internally.
hash, _ := db.Get(headerHashKey(number))
data, _ = db.Get(blockBodyKey(number, common.BytesToHash(hash)))
return nil
})
return data
Expand Down

0 comments on commit 66a908c

Please sign in to comment.