renamed swap database directory (#482)

This commit is contained in:
Dmitry Holodov
2023-06-07 13:29:33 -05:00
committed by GitHub
parent 584858f53a
commit c3cce999ca
2 changed files with 8 additions and 2 deletions

View File

@@ -29,6 +29,12 @@ import (
"github.com/athanorlabs/atomic-swap/rpc" "github.com/athanorlabs/atomic-swap/rpc"
) )
const (
// databaseDirName is the name of the folder, located in the swapd's
// data-dir, for the current and past swap information.
databaseDirName = "swap-db"
)
var log = logging.Logger("daemon") var log = logging.Logger("daemon")
// SwapdConfig provides startup parameters for swapd. // SwapdConfig provides startup parameters for swapd.
@@ -63,7 +69,7 @@ func RunSwapDaemon(ctx context.Context, conf *SwapdConfig) (err error) {
// Initialize the database first, so the defer statement that closes it // Initialize the database first, so the defer statement that closes it
// will get executed last. // will get executed last.
sdb, err := db.NewDatabase(&chaindb.Config{ sdb, err := db.NewDatabase(&chaindb.Config{
DataDir: path.Join(conf.EnvConf.DataDir, "db"), DataDir: path.Join(conf.EnvConf.DataDir, databaseDirName),
}) })
if err != nil { if err != nil {
return err return err

View File

@@ -13,7 +13,7 @@ and `ENV` is the value from the `--env` flag (e.g. `stagenet`, `mainnet`).
From here forward, we will use `{DATA_DIR}` to refer to this default value or the value From here forward, we will use `{DATA_DIR}` to refer to this default value or the value
passed with the `--data-dir` flag. passed with the `--data-dir` flag.
### {DATA_DIR}/db ### {DATA_DIR}/swap-db
This is the location of swapd's (BadgerDB) database. Currently, it stores offers made so that This is the location of swapd's (BadgerDB) database. Currently, it stores offers made so that
they can be reloaded on restart. The database can be safely deleted if you don't have any offers they can be reloaded on restart. The database can be safely deleted if you don't have any offers