Skip to content

Commit f759e90

Browse files
committed
core/rawdb: add sanity-limit to header accessor
1 parent cc4b24e commit f759e90

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

core/rawdb/accessors_chain.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,8 @@ func ReadHeaderRange(db prldb.Reader, number uint64, count uint64) []rlp.RawValu
333333
if count == 0 {
334334
return rlpHeaders
335335
}
336-
// read remaining from ancients
337-
max := count * 700
338-
data, err := db.AncientRange(freezerHeaderTable, i+1-count, count, max)
336+
// read remaining from ancients, cap at 2M
337+
data, err := db.AncientRange(freezerHeaderTable, i+1-count, count, 2*1024*1024)
339338
if err == nil && uint64(len(data)) == count {
340339
// the data is on the order [h, h+1, .., n] -- reordering needed
341340
for i := range data {

0 commit comments

Comments
 (0)