Skip to content
Permalink
Browse files

fix(lnd): delete tmp wallets to ensure lnd compatibility

  • Loading branch information...
mrfelton committed Jun 12, 2019
1 parent 87104b0 commit c2a05644f2c5e3e5e794126a8a016f36f2a5377a
Showing with 27 additions and 0 deletions.
  1. +22 −0 electron/migrations/delete-tmp-wallets.js
  2. +5 −0 electron/migrator.js
@@ -0,0 +1,22 @@
import config from 'config'
import { mainLog } from '@zap/utils/log'
import { getAllLocalWallets, deleteLocalWallet } from '@zap/utils/localWallets'

/**
* migration - Migration script to delete all tmp wallets from the filesystem.
*
* @returns {undefined}
*/
const migration = async () => {
const { chains, networks } = config
const isTmpWallet = wallet => wallet.wallet == 'wallet-tmp'
const allLocalWallets = await getAllLocalWallets(chains, networks)
const tmpWallets = allLocalWallets.filter(isTmpWallet)
mainLog.debug('Found tmp wallets to delete: %O', tmpWallets)

for (const wallet of tmpWallets) {
await deleteLocalWallet(wallet)
}
}

export default migration
@@ -3,6 +3,7 @@ import { join } from 'path'
import { promisify } from 'util'
import { app } from 'electron'
import migration_1 from './migrations/purge-local-wallets'
import migration_2 from './migrations/delete-tmp-wallets'

const fsWriteFile = promisify(writeFile)
const fsReadFile = promisify(readFile)
@@ -24,6 +25,10 @@ class ZapMigrator {
id: 1,
up: migration_1,
},
{
id: 2,
up: migration_2,
},
]
}

0 comments on commit c2a0564

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