Skip to content
Permalink
Browse files

fix(wallet): filter non wallet dirs and files

fix #1862
  • Loading branch information...
korhaliv committed Mar 27, 2019
1 parent 5e1107e commit c7d3c0161dd6a9ed1eeb23ea5a5b7c202d1d8c8b
Showing with 5 additions and 2 deletions.
  1. +5 −2 utils/localWallets.js
@@ -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'

@@ -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,

0 comments on commit c7d3c01

Please sign in to comment.
You can’t perform that action at this time.