Skip to content

Commit 0050ca9

Browse files
authored
Merge pull request ethereum#445 from etclabscore/fix/double-lock-hang
core/rawdb: fix double-lock causing hang (ethereum#24189)
2 parents c3ee28f + 0cfd4f8 commit 0050ca9

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
@@ -415,8 +415,11 @@ func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue {
415415
if len(data) > 0 {
416416
return nil
417417
}
418-
// Get it by hash from leveldb
419-
data, _ = db.Get(blockBodyKey(number, ReadCanonicalHash(db, number)))
418+
// Block is not in ancients, read from leveldb by hash and number.
419+
// Note: ReadCanonicalHash cannot be used here because it also
420+
// calls ReadAncients internally.
421+
hash, _ := db.Get(headerHashKey(number))
422+
data, _ = db.Get(blockBodyKey(number, common.BytesToHash(hash)))
420423
return nil
421424
})
422425
return data

0 commit comments

Comments
 (0)