Skip to content

Commit ca1f041

Browse files
holimanfjl
authored andcommitted
core/rawdb: fix double-lock causing hang (ethereum#24189)
Fixes ethereum#24159 Co-authored-by: Felix Lange <[email protected]>
1 parent 485c05b commit ca1f041

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/rawdb/accessors_chain.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,11 @@ func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue {
447447
if len(data) > 0 {
448448
return nil
449449
}
450-
// Get it by hash from leveldb
451-
data, _ = db.Get(blockBodyKey(number, ReadCanonicalHash(db, number)))
450+
// Block is not in ancients, read from leveldb by hash and number.
451+
// Note: ReadCanonicalHash cannot be used here because it also
452+
// calls ReadAncients internally.
453+
hash, _ := db.Get(headerHashKey(number))
454+
data, _ = db.Get(blockBodyKey(number, common.BytesToHash(hash)))
452455
return nil
453456
})
454457
return data

0 commit comments

Comments
 (0)