Skip to content

Commit

Permalink
remove duplicates from AllKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
jimjbrettj committed Aug 26, 2024
1 parent b6a687d commit 7d3ec68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/runtime/storage/storagediff.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ func (cs *storageDiff) clearPrefixInChild(keyToChild string, prefix []byte,
func (cs *storageDiff) clearPrefix(prefix []byte, trieKeys []string, limit int) (deleted uint32, allDeleted bool) {
allKeys := slices.Clone(trieKeys)
newKeys := maps.Keys(cs.upserts)
allKeys = append(allKeys, newKeys...)
for _, k := range newKeys {
if !slices.Contains(allKeys, k) {
allKeys = append(allKeys, k)
}
}

deleted = 0
sort.Strings(allKeys)
Expand Down

0 comments on commit 7d3ec68

Please sign in to comment.