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

Fixes #24159

Co-authored-by: Felix Lange <fjl@twurst.com>
release/1.10
Martin Holst Swende 3 years ago committed by GitHub
parent d0bd5017ed
commit 66a908c5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      core/rawdb/accessors_chain.go

@ -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

Loading…
Cancel
Save