Commit 8f56a3d9 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6977 from ethereum-optimism/refcell/nit-fix-game-dir-comments

chore(op-challenger): Fix Disk Manager Comments
parents d0a96753 69a7ed4f
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
const gameDirPrefix = "game-" const gameDirPrefix = "game-"
// diskManager coordinates // diskManager coordinates the storage of game data on disk.
type diskManager struct { type diskManager struct {
datadir string datadir string
} }
...@@ -42,11 +42,11 @@ func (d *diskManager) RemoveAllExcept(keep []common.Address) error { ...@@ -42,11 +42,11 @@ func (d *diskManager) RemoveAllExcept(keep []common.Address) error {
name := entry.Name()[len(gameDirPrefix):] name := entry.Name()[len(gameDirPrefix):]
addr := common.HexToAddress(name) addr := common.HexToAddress(name)
if addr == (common.Address{}) { if addr == (common.Address{}) {
// Couldn't parse the directory name to an address so mustn't be a game directory // Ignore directories with non-address names.
continue continue
} }
if slices.Contains(keep, addr) { if slices.Contains(keep, addr) {
// We need to preserve this data // Preserve data for games we should keep.
continue continue
} }
if err := os.RemoveAll(filepath.Join(d.datadir, entry.Name())); err != nil { if err := os.RemoveAll(filepath.Join(d.datadir, entry.Name())); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment