Browse Source

only send a few params on non-LND ping

loopout2
Evan Feenstra 4 years ago
parent
commit
f6024548fc
  1. 20
      dist/src/utils/nodeinfo.js
  2. 2
      dist/src/utils/nodeinfo.js.map
  3. 25
      src/utils/nodeinfo.ts

20
dist/src/utils/nodeinfo.js

@ -15,16 +15,8 @@ const gitinfo_1 = require("../utils/gitinfo");
const models_1 = require("../models");
function nodeinfo() {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let public_ip = "";
try {
public_ip = yield publicIp.v4();
}
catch (e) { }
const commitHash = yield gitinfo_1.checkCommitHash();
const tag = yield gitinfo_1.checkTag();
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const clean = yield isClean();
const latest_message = yield latestMessage();
try {
yield lightning_1.getInfo();
}
@ -34,16 +26,20 @@ function nodeinfo() {
ip: process.env.NODE_IP,
lnd_port: process.env.NODE_LND_PORT,
relay_commit: commitHash,
public_ip: public_ip,
pubkey: owner.publicKey,
relay_version: tag,
clean,
latest_message,
wallet_locked: true,
};
resolve(node);
return;
}
let public_ip = "";
try {
public_ip = yield publicIp.v4();
}
catch (e) { }
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const clean = yield isClean();
const latest_message = yield latestMessage();
const lightning = lightning_1.loadLightning();
try {
lightning.channelBalance({}, (err, channelBalance) => {

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

@ -1 +1 @@
{"version":3,"file":"nodeinfo.js","sourceRoot":"","sources":["../../../src/utils/nodeinfo.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,kDAAyD;AACzD,sCAAqC;AACrC,8CAA0D;AAC1D,sCAAgC;AAEhC,SAAS,QAAQ;IACf,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAC,EAAE;QAC1C,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI;YACF,SAAS,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,CAAA;SAChC;QAAC,OAAM,CAAC,EAAC,GAAE;QA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GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAA;QAC9B,IAAG,IAAI,EAAE;YACP,OAAO,IAAI,CAAC,SAAS,CAAA;SACtB;aAAM;YACL,OAAO,EAAE,CAAA;SACV;IACH,CAAC;CAAA"}

25
src/utils/nodeinfo.ts

@ -6,21 +6,11 @@ import {models} from '../models'
function nodeinfo(){
return new Promise(async (resolve, reject)=>{
let public_ip = ""
try {
public_ip = await publicIp.v4()
} catch(e){}
const commitHash = await checkCommitHash()
const tag = await checkTag()
const owner = await models.Contact.findOne({ where: { isOwner: true }})
const clean = await isClean()
const latest_message = await latestMessage()
try {
await getInfo()
} catch(e) { // no LND
@ -29,17 +19,24 @@ function nodeinfo(){
ip: process.env.NODE_IP,
lnd_port: process.env.NODE_LND_PORT,
relay_commit: commitHash,
public_ip: public_ip,
pubkey: owner.publicKey,
relay_version: tag,
clean,
latest_message,
wallet_locked: true,
}
resolve(node)
return
}
let public_ip = ""
try {
public_ip = await publicIp.v4()
} catch(e){}
const owner = await models.Contact.findOne({ where: { isOwner: true }})
const clean = await isClean()
const latest_message = await latestMessage()
const lightning = loadLightning()
try {
lightning.channelBalance({}, (err, channelBalance) => {

Loading…
Cancel
Save