From 0ce5b04fe51e81bd1a4915c334cba12ccf1cb29b Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Fri, 15 Jun 2018 18:41:59 -0500 Subject: [PATCH] Don't run onboarding if LND is already running locally The onboarding settings are only relevant if the user wants to connect to a remote LND or have Zap run LND. If the LND is already running locally, the user is capable of separately configuring it. This does not support the case of connecting to a remote LND while running LND locally, but I can't think of a reason why someone would do such a thing. In such a case, they could quit LND, start Zap, then re-start LND. --- app/main.dev.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/main.dev.js b/app/main.dev.js index 3fcc8654..b0f13531 100644 --- a/app/main.dev.js +++ b/app/main.dev.js @@ -274,8 +274,25 @@ app.on('ready', async () => { sendGrpcDisconnected() - // Let the application know onboarding has started. - sendStartOnboarding() + console.log('LOOKING FOR LOCAL LND') + // Check to see if an LND process is running. + lookup({ command: 'lnd' }, (err, results) => { + // There was an error checking for the LND process. + if (err) { + throw new Error(err) + } + + // No LND process was found. + if (!results.length) { + // Let the application know onboarding has started. + sendStartOnboarding() + } else { + // An LND process was found, no need to start our own. + console.log('LND ALREADY RUNNING') + startGrpc() + mainWindow.webContents.send('successfullyCreatedWallet') + } + }) // Start LND // once the onboarding has enough information, start or connect to LND. @@ -295,24 +312,7 @@ app.on('ready', async () => { console.log('SAVED CONFIG TO:', store.path, 'AS', store.store) if (options.connectionType === 'local') { - console.log('LOOKING FOR LOCAL LND') - // Check to see if an LND process is running. - lookup({ command: 'lnd' }, (err, results) => { - // There was an error checking for the LND process. - if (err) { - throw new Error(err) - } - - // No LND process was found. - if (!results.length) { - startLnd(options.alias, options.autopilot) - } else { - // An LND process was found, no need to start our own. - console.log('LND ALREADY RUNNING') - startGrpc() - mainWindow.webContents.send('successfullyCreatedWallet') - } - }) + startLnd(options.alias, options.autopilot) } else { console.log('USING CUSTOM LND') startGrpc()