Skip to content

Commit 81662fe

Browse files
authored
core/rawdb: handle prefix in table.compact method (ethereum#22911)
1 parent a6c4627 commit 81662fe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/rawdb/table.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ func (t *table) Compact(start []byte, limit []byte) error {
131131
// If no start was specified, use the table prefix as the first value
132132
if start == nil {
133133
start = []byte(t.prefix)
134+
} else {
135+
start = append([]byte(t.prefix), start...)
134136
}
135137
// If no limit was specified, use the first element not matching the prefix
136138
// as the limit
@@ -147,6 +149,8 @@ func (t *table) Compact(start []byte, limit []byte) error {
147149
limit = nil
148150
}
149151
}
152+
} else {
153+
limit = append([]byte(t.prefix), limit...)
150154
}
151155
// Range correctly calculated based on table prefix, delegate down
152156
return t.db.Compact(start, limit)

0 commit comments

Comments
 (0)