Browse Source

lg

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
10fbea2e59
  1. 4
      dist/src/grpc/index.js
  2. 2
      dist/src/grpc/index.js.map
  3. 6
      dist/src/utils/unlock.js
  4. 2
      dist/src/utils/unlock.js.map
  5. 4
      src/grpc/index.ts
  6. 8
      src/utils/unlock.ts

4
dist/src/grpc/index.js

@ -18,6 +18,7 @@ const lightning_1 = require("../utils/lightning");
const network = require("../network");
const moment = require("moment");
const constants_1 = require("../constants");
const unlock_1 = require("../utils/unlock");
const ERR_CODE_UNAVAILABLE = 14;
const ERR_CODE_STREAM_REMOVED = 2;
const ERR_CODE_UNIMPLEMENTED = 12; // locked
@ -149,9 +150,8 @@ function reconnectToLND(innerCtx) {
resolve();
}
catch (e) {
console.log(`=> ${now} [lnd] error connecting ${e.message}`);
if (e.code === ERR_CODE_UNIMPLEMENTED) {
console.log("UNLOCK EHRE!!!!!");
yield unlock_1.tryToUnlockLND();
}
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
if (ctx === innerCtx) { // if another retry fires, then this will not run

2
dist/src/grpc/index.js.map

File diff suppressed because one or more lines are too long

6
dist/src/utils/unlock.js

@ -18,12 +18,14 @@ const config = require(path.join(__dirname, '../../config/app.json'))[env];
// /relay/.lnd/.lndpwd
function tryToUnlockLND() {
return __awaiter(this, void 0, void 0, function* () {
const p = config.lnd_pwd;
const p = config.lnd_pwd_path;
if (!p)
return;
var pwd = getFirstLine(config.lnd_pwd);
console.log('==>', p);
var pwd = getFirstLine(config.lnd_pwd_path);
if (!pwd)
return;
console.log('==>', pwd);
yield lightning_1.unlockWallet(pwd);
});
}

2
dist/src/utils/unlock.js.map

@ -1 +1 @@
{"version":3,"file":"unlock.js","sourceRoot":"","sources":["../../../src/utils/unlock.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,2CAA0C;AAC1C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,MAA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 @@ import {loadLightning} from '../utils/lightning'
import * as network from '../network'
import * as moment from 'moment'
import constants from '../constants'
import {tryToUnlockLND} from '../utils/unlock'
const ERR_CODE_UNAVAILABLE = 14
const ERR_CODE_STREAM_REMOVED = 2
@ -142,9 +143,8 @@ export async function reconnectToLND(innerCtx:number) {
console.log(`=> [lnd] connected! ${now}`)
resolve()
} catch(e) {
console.log(`=> ${now} [lnd] error connecting ${e.message}`)
if(e.code===ERR_CODE_UNIMPLEMENTED) {
console.log("UNLOCK EHRE!!!!!")
await tryToUnlockLND()
}
setTimeout(async()=>{ // retry each 2 secs
if(ctx===innerCtx) { // if another retry fires, then this will not run

8
src/utils/unlock.ts

@ -9,12 +9,16 @@ const config = require(path.join(__dirname, '../../config/app.json'))[env]
// /relay/.lnd/.lndpwd
export async function tryToUnlockLND() {
const p = config.lnd_pwd
const p = config.lnd_pwd_path
if (!p) return
var pwd = getFirstLine(config.lnd_pwd);
console.log('==>',p)
var pwd = getFirstLine(config.lnd_pwd_path);
if(!pwd) return
console.log('==>',pwd)
await unlockWallet(pwd)
}

Loading…
Cancel
Save