core/rawdb: add sanity-limit to header accessor

This commit is contained in:
marcello33 2024-05-06 16:23:36 +02:00 committed by Anshal Shukla
parent 3c284fa8af
commit 0eceaca6f2
No known key found for this signature in database
GPG key ID: 84BE5474523D8CBC

View file

@ -362,8 +362,8 @@ func ReadHeaderRange(db ethdb.Reader, number uint64, count uint64) []rlp.RawValu
if count == 0 {
return rlpHeaders
}
// read remaining from ancients
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, 0)
// read remaining from ancients, cap at 2M
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, 2*1024*1024)
if err != nil {
log.Error("Failed to read headers from freezer", "err", err)
return rlpHeaders