Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix(wallet): filter non wallet dirs and files
Browse files Browse the repository at this point in the history
fix #1862
  • Loading branch information
korhaliv committed Mar 27, 2019
1 parent 5e1107e commit c7d3c01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions utils/localWallets.js
Expand Up @@ -2,7 +2,7 @@ import electron, { remote } from 'electron'
import { promisify } from 'util'
import assert from 'assert'
import { join } from 'path'
import { readdir } from 'fs'
import { readdir, existsSync } from 'fs'
import rimraf from 'rimraf'
import root from 'window-or-global'

Expand All @@ -18,7 +18,10 @@ export async function getLocalWallets(chain, network) {
const app = electron.app || remote.app
const walletDir = join(app.getPath('userData'), 'lnd', chain, network)
const wallets = await fsReaddir(walletDir)
return wallets.map(wallet => ({

// Look for tls.cert file inside wallet dir to consider it a wallet candidate
const isWalletDir = wallet => existsSync(join(walletDir, wallet, 'tls.cert'))
return wallets.filter(isWalletDir).map(wallet => ({
type: 'local',
chain,
network,
Expand Down

0 comments on commit c7d3c01

Please sign in to comment.