Unverified Commit 66a908c5 authored by Martin Holst Swende's avatar Martin Holst Swende Committed by GitHub

core/rawdb: fix double-lock causing hang (#24189)

Fixes #24159
Co-authored-by: 's avatarFelix Lange <fjl@twurst.com>
parent d0bd5017
...@@ -447,8 +447,11 @@ func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue { ...@@ -447,8 +447,11 @@ func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue {
if len(data) > 0 { if len(data) > 0 {
return nil return nil
} }
// Get it by hash from leveldb // Block is not in ancients, read from leveldb by hash and number.
data, _ = db.Get(blockBodyKey(number, ReadCanonicalHash(db, 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 nil
}) })
return data return data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment