Skip to content

Commit

Permalink
don't remove old regression DB
Browse files Browse the repository at this point in the history
  • Loading branch information
BrannonKing authored and roylee17 committed Dec 10, 2021
1 parent 6c13a60 commit f008e66
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions lbcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,34 +183,6 @@ func btcdMain(serverChan chan<- *server) error {
return nil
}

// removeRegressionDB removes the existing regression test database if running
// in regression test mode and it already exists.
func removeRegressionDB(dbPath string) error {
// Don't do anything if not in regression test mode.
if !cfg.RegressionTest {
return nil
}

// Remove the old regression test database if it already exists.
fi, err := os.Stat(dbPath)
if err == nil {
btcdLog.Infof("Removing regression test database from '%s'", dbPath)
if fi.IsDir() {
err := os.RemoveAll(dbPath)
if err != nil {
return err
}
} else {
err := os.Remove(dbPath)
if err != nil {
return err
}
}
}

return nil
}

// dbPath returns the path to the block database given a database type.
func blockDbPath(dbType string) string {
// The database name is based on the database type.
Expand Down Expand Up @@ -277,11 +249,6 @@ func loadBlockDB() (database.DB, error) {

// The database name is based on the database type.
dbPath := blockDbPath(cfg.DbType)

// The regression test is special in that it needs a clean database for
// each run, so remove it now if it already exists.
removeRegressionDB(dbPath)

btcdLog.Infof("Loading block database from '%s'", dbPath)
db, err := database.Open(cfg.DbType, dbPath, activeNetParams.Net)
if err != nil {
Expand Down

0 comments on commit f008e66

Please sign in to comment.