Skip to content

Commit

Permalink
Revert "Merge pull request #6641 from spacemeshos/node-split/setupDBs"
Browse files Browse the repository at this point in the history
This reverts commit f31f02b, reversing
changes made to ef83c0c.
  • Loading branch information
poszu committed Jan 21, 2025
1 parent 76281db commit ea8b116
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
16 changes: 1 addition & 15 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ func (app *App) stopServices(ctx context.Context) {
grpczap.SetGrpcLoggerV2(grpcLog, log.NewNop().Zap())
}

func (app *App) setupStateAPIAndCacheDBs(ctx context.Context, lg log.Log) error {
func (app *App) setupDBs(ctx context.Context, lg log.Log) error {
dbPath := app.Config.DataDir()
if err := os.MkdirAll(dbPath, os.ModePerm); err != nil {
return fmt.Errorf("failed to create %s: %w", dbPath, err)
Expand Down Expand Up @@ -2245,12 +2245,6 @@ func (app *App) setupStateAPIAndCacheDBs(ctx context.Context, lg log.Log) error
datastore.WithConsensusCache(app.atxsdata),
)

return nil
}

func (app *App) setupLocalDB(ctx context.Context, lg log.Log) error {
dbPath := app.Config.DataDir()
dbLog := app.addLogger(StateDbLogger, lg).Zap()
lSchema, err := localmigrations.SchemaWithInCodeMigrations()
if err != nil {
return fmt.Errorf("error loading db schema: %w", err)
Expand All @@ -2270,14 +2264,6 @@ func (app *App) setupLocalDB(ctx context.Context, lg log.Log) error {
return nil
}

func (app *App) setupDBs(ctx context.Context, lg log.Log) error {
if err := app.setupStateAPIAndCacheDBs(ctx, lg); err != nil {
return err
}

return app.setupLocalDB(ctx, lg)
}

// Start starts the Spacemesh node service and initializes all relevant
// services according to command line arguments provided.
func (app *App) Start(ctx context.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion node/smeshing_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func (app *App) startSmeshingServiceSynchronous(ctx context.Context) (err error)
return fmt.Errorf("cannot create clock: %w", err)
}

if err := app.setupLocalDB(ctx, logger); err != nil {
if err := app.setupDBs(ctx, logger); err != nil {
return err
}

Expand Down

0 comments on commit ea8b116

Please sign in to comment.