Skip to content

Commit

Permalink
core/rawdb: handle prefix in table.compact method (ethereum#22911)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evolution404 authored and jwasinger committed Jul 25, 2021
1 parent 2a3bdf5 commit fdde864
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/rawdb/table.go
Expand Up @@ -131,6 +131,8 @@ func (t *table) Compact(start []byte, limit []byte) error {
// If no start was specified, use the table prefix as the first value
if start == nil {
start = []byte(t.prefix)
} else {
start = append([]byte(t.prefix), start...)
}
// If no limit was specified, use the first element not matching the prefix
// as the limit
Expand All @@ -147,6 +149,8 @@ func (t *table) Compact(start []byte, limit []byte) error {
limit = nil
}
}
} else {
limit = append([]byte(t.prefix), limit...)
}
// Range correctly calculated based on table prefix, delegate down
return t.db.Compact(start, limit)
Expand Down

0 comments on commit fdde864

Please sign in to comment.