Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
Fixed for the devnet runner (erigontech#7808)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Sharp <[email protected]>
  • Loading branch information
AlexeyAkhunov and Alex Sharp authored Jun 28, 2023
1 parent bcc2a4a commit 0a1229b
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions cmd/devnet/devnetutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@ var ErrInvalidEnodeString = errors.New("invalid enode string")
func ClearDevDB(dataDir string, logger log.Logger) error {
logger.Info("Deleting nodes' data folders")

nodeNumber := 0
for {
for nodeNumber := 0; nodeNumber < 100; nodeNumber++ { // Arbitrary number
nodeDataDir := filepath.Join(dataDir, fmt.Sprintf("%d", nodeNumber))
fileInfo, err := os.Stat(nodeDataDir)
if err != nil {
if os.IsNotExist(err) {
break
continue
}
return err
}
if fileInfo.IsDir() {
if err := os.RemoveAll(nodeDataDir); err != nil {
return err
}
logger.Info("SUCCESS => Deleted", "datadir", nodeDataDir)
} else {
break
if !fileInfo.IsDir() {
continue
}
if err := os.RemoveAll(nodeDataDir); err != nil {
return err
}
nodeNumber++
logger.Info("SUCCESS => Deleted", "datadir", nodeDataDir)
}
return nil
}
Expand Down

0 comments on commit 0a1229b

Please sign in to comment.