Skip to content

Commit

Permalink
Fix WalletAppConfig.hasWallet for Postgres (#1576)
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Jun 24, 2020
1 parent d3641c3 commit ea62374
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,20 @@ case class WalletAppConfig(
}

/** Checks if the following exist
* 1. A wallet exists
* 2. seed exists
* 1. A seed exists
* 2. wallet exists
* 3. The account exists */
def hasWallet()(implicit ec: ExecutionContext): Future[Boolean] = {
val walletDB = dbPath.resolve(dbName)
val hdCoin = defaultAccount.coin
if (Files.exists(walletDB) && seedExists()) {
AccountDAO()(ec, this).read((hdCoin, 0)).map(_.isDefined)
private def hasWallet()(
implicit walletConf: WalletAppConfig,
ec: ExecutionContext): Future[Boolean] = {
if (walletConf.seedExists()) {
val hdCoin = walletConf.defaultAccount.coin
val walletDB = walletConf.dbPath resolve walletConf.dbName
if (walletConf.driverName == "postgresql" || Files.exists(walletDB)) {
AccountDAO().read((hdCoin, 0)).map(_.isDefined)
} else {
Future.successful(false)
}
} else {
Future.successful(false)
}
Expand Down

0 comments on commit ea62374

Please sign in to comment.