Last active
March 27, 2018 22:57
-
-
Save mcgingras/aff2bc93547ae50d793fd291aef56447 to your computer and use it in GitHub Desktop.
LN error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const grpc = require('grpc'); | |
const fs = require("fs"); | |
// Lnd cert is at ~/.lnd/tls.cert on Linux and | |
// ~/Library/Application Support/Lnd/tls.cert on Mac | |
const lndCert = fs.readFileSync('/Users/mcgingras/Library/Application Support/LND/tls.cert'); | |
const adminMacaroon = fs.readFileSync('/Users/mcgingras/Library/Application Support/LND/admin.macaroon'); | |
const meta = new grpc.Metadata(); | |
meta.add('macaroon', adminMacaroon.toString('hex')); | |
// We order the suites by priority, based on the recommendations provided by SSL Labs here: | |
// https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices#23-use-secure-cipher-suites | |
process.env.GRPC_SSL_CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES || [ | |
'ECDHE-ECDSA-AES128-GCM-SHA256', | |
'ECDHE-ECDSA-AES256-GCM-SHA384', | |
'ECDHE-ECDSA-AES128-CBC-SHA256', | |
'ECDHE-ECDSA-CHACHA20-POLY1305' | |
].join(':') | |
const credentials = grpc.credentials.createSsl(lndCert); | |
const rpc = grpc.load("./config/rpc.proto"); | |
const lightning = new rpc.lnrpc.Lightning('localhost:10001', credentials); | |
const walletUnlocker = new rpc.lnrpc.WalletUnlocker('localhost:10001', credentials); | |
// this one works fine | |
var _call = lightning.walletBalance({}, meta, function(err, response) { | |
if (err) console.log(err); | |
if (response) console.log(response); | |
}); | |
// this one returns an error | |
var _call = walletUnlocker.initWallet({}, meta, function(err, response) { | |
if (err) console.log(err); | |
if (response) console.log(response); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment