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 committed May 21, 2021
1 parent a6c4627 commit 81662fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/rawdb/table.go
Original file line number Diff line number Diff line change
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 81662fe

Please sign in to comment.