mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopd: cleanup db utils func
This commit is contained in:
parent
ab30e0b4e8
commit
5214da8822
1 changed files with 4 additions and 9 deletions
|
|
@ -56,9 +56,8 @@ func openDatabase(cfg *Config, chainParams *chaincfg.Params) (loopdb.SwapStore,
|
|||
case DatabaseBackendSqlite:
|
||||
log.Infof("Opening sqlite3 database at: %v",
|
||||
cfg.Sqlite.DatabaseFileName)
|
||||
db, err = loopdb.NewSqliteStore(
|
||||
cfg.Sqlite, chainParams,
|
||||
)
|
||||
|
||||
db, err = loopdb.NewSqliteStore(cfg.Sqlite, chainParams)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
@ -67,9 +66,8 @@ func openDatabase(cfg *Config, chainParams *chaincfg.Params) (loopdb.SwapStore,
|
|||
case DatabaseBackendPostgres:
|
||||
log.Infof("Opening postgres database at: %v",
|
||||
cfg.Postgres.DSN(true))
|
||||
db, err = loopdb.NewPostgresStore(
|
||||
cfg.Postgres, chainParams,
|
||||
)
|
||||
|
||||
db, err = loopdb.NewPostgresStore(cfg.Postgres, chainParams)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
@ -79,9 +77,6 @@ func openDatabase(cfg *Config, chainParams *chaincfg.Params) (loopdb.SwapStore,
|
|||
return nil, nil, fmt.Errorf("unknown database backend: %s",
|
||||
cfg.DatabaseBackend)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("unable to open database: %v", err)
|
||||
}
|
||||
|
||||
return db, &baseDb, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue