From 4b4765e2d765b9ac6b51aaeeb99ab8a7560ccd4a Mon Sep 17 00:00:00 2001 From: elnosh Date: Wed, 30 Oct 2024 17:56:58 -0500 Subject: [PATCH] fixes: pass mint path in config and create wallet dir in restore --- cmd/mint/mint.go | 2 +- wallet/wallet.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/mint/mint.go b/cmd/mint/mint.go index d5fbf71..25d6480 100644 --- a/cmd/mint/mint.go +++ b/cmd/mint/mint.go @@ -160,7 +160,7 @@ func configFromEnv() (*mint.Config, error) { return &mint.Config{ DerivationPathIdx: uint32(derivationPathIdx), Port: port, - MintPath: os.Getenv("MINT_DB_PATH"), + MintPath: mintPath, DBMigrationPath: "../../mint/storage/sqlite/migrations", InputFeePpk: inputFeePpk, MintInfo: mintInfo, diff --git a/wallet/wallet.go b/wallet/wallet.go index 8f2f2f3..adc3a8f 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -1760,6 +1760,10 @@ func Restore(walletPath, mnemonic string, mintsToRestore []string) (cashu.Proofs return nil, errors.New("wallet already exists") } + if err := os.MkdirAll(walletPath, 0700); err != nil { + return nil, err + } + // check mnemonic is valid if !bip39.IsMnemonicValid(mnemonic) { return nil, errors.New("invalid mnemonic")