Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 752ada2

Browse files
committed
Add --rpcuser and —rpcpass flag to add to trigger rpc mode
1 parent 8017441 commit 752ada2

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

public/electron.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ ipcMain.on('log-error', (event, arg) => log.error(...arg));
4646
let logQueue = [];
4747
let logsReady = false;
4848

49+
const getArgv = arg =>
50+
(process.argv.find(a => a.includes(`--${arg}=`)) || '').split('=')[1];
51+
4952
const sendLog = log => {
5053
if (win && logsReady) {
5154
win.webContents.send('logs', log);
@@ -131,6 +134,8 @@ const startLnd = async () => {
131134
});
132135
lndProcess = await startLndProcess({
133136
isDev,
137+
rpcUser: getArgv('rpcuser'),
138+
rpcPass: getArgv('rpcpass'),
134139
lndSettingsDir,
135140
macaroonsEnabled: MACAROONS_ENABLED,
136141
lndPort: LND_PORT,

public/lnd-child-process.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function startBlockingProcess(name, args, logger) {
4747

4848
module.exports.startLndProcess = async function({
4949
isDev,
50+
rpcUser,
51+
rpcPass,
5052
macaroonsEnabled,
5153
lndSettingsDir,
5254
lndPort,
@@ -55,16 +57,17 @@ module.exports.startLndProcess = async function({
5557
lndRestPort,
5658
}) {
5759
if (!lndSettingsDir) throw new Error('lndSettingsDir not set!');
60+
const rpc = !!rpcUser;
5861
const processName = 'lnd';
5962
const args = [
6063
'--bitcoin.active',
6164
isDev ? '--bitcoin.simnet' : '--bitcoin.testnet',
62-
isDev ? '--btcd.rpcuser=kek' : '',
63-
isDev ? '--btcd.rpcpass=kek' : '',
64-
isDev ? '--bitcoin.node=btcd' : '--bitcoin.node=neutrino',
65-
isDev ? '' : `--configfile=${path.join(lndSettingsDir, 'lnd.conf')}`,
66-
isDev ? '' : '--neutrino.connect=btcd0.lightning.engineering',
67-
isDev ? '' : '--neutrino.connect=127.0.0.1:18333',
65+
isDev || rpcUser ? `--btcd.rpcuser=${rpcUser || 'kek'}` : '',
66+
isDev || rpcPass ? `--btcd.rpcpass=${rpcPass || 'kek'}` : '',
67+
isDev || rpc ? '--bitcoin.node=btcd' : '--bitcoin.node=neutrino',
68+
isDev || rpc ? '' : `--configfile=${path.join(lndSettingsDir, 'lnd.conf')}`,
69+
isDev || rpc ? '' : '--neutrino.connect=btcd0.lightning.engineering',
70+
isDev || rpc ? '' : '--neutrino.connect=127.0.0.1:18333',
6871
isDev ? '' : '--autopilot.active',
6972

7073
macaroonsEnabled ? '' : '--no-macaroons',

0 commit comments

Comments
 (0)