Merge pull request #440 from shocknet/initial-lnd-socket-fix

Initial lnd socket fix
This commit is contained in:
CapDog 2021-07-25 17:21:01 -04:00 committed by GitHub
commit 41a12ba78c
2 changed files with 54 additions and 2 deletions

44
.vscode/launch.json vendored
View file

@ -1,7 +1,7 @@
{
"configurations": [
{
"name": "Launch Program Via Nodemon",
"name": "Nodemon",
"program": "${workspaceFolder}/main.js",
"args": ["--", "-h", "0.0.0.0", "-c"],
"request": "launch",
@ -22,6 +22,48 @@
// (after 10 seconds). To avoid this, you can increase the timeout by
// adding a timeout attribute with a larger value (in milliseconds).
"runtimeExecutable": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"restart": true
},
{
"name": "Nodemon+Polar",
"program": "${workspaceFolder}/main.js",
"args": [
"--",
"-h",
"0.0.0.0",
"-c",
"-s",
"9835",
"-l",
"127.0.0.1:10001",
"-r",
"localhost:9735",
"-m",
"/home/danlugo92/.polar/networks/1/volumes/lnd/alice/data/chain/bitcoin/regtest/admin.macaroon",
"-d",
"/home/danlugo92/.polar/networks/1/volumes/lnd/alice/tls.cert"
],
"request": "launch",
"skipFiles": ["<node_internals>/**"],
"type": "node",
"envFile": "${workspaceFolder}/.env",
"outputCapture": "std",
// https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_restarting-debug-sessions-automatically-when-source-is-edited
// Tip: Pressing the Stop button stops the debug session and disconnects
// from Node.js, but nodemon (and Node.js) will continue to run. To stop
// nodemon, you will have to kill it from the command line (which is
// easily possible if you use the integratedTerminal as shown above).
// Tip: In case of syntax errors, nodemon will not be able to start
// Node.js successfully until the error has been fixed. In this case, VS
// Code will continue trying to attach to Node.js but eventually give up
// (after 10 seconds). To avoid this, you can increase the timeout by
// adding a timeout attribute with a larger value (in milliseconds).
"runtimeExecutable": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",

View file

@ -57,7 +57,16 @@ module.exports = (
const { services } = LightningServices
const { service, method, args: unParsed } = socket.handshake.auth
const {
service,
method,
args: unParsed,
isInitial
} = socket.handshake.auth
if (isInitial) {
return
}
const args = JSON.parse(unParsed)
@ -100,6 +109,7 @@ module.exports = (
call.write(args)
})
} catch (err) {
logger.error(err)
logger.error('LNDRPC: ' + err.message)
}
})