|
@ -20,7 +20,6 @@ const moment = require("moment"); |
|
|
const path = require("path"); |
|
|
const path = require("path"); |
|
|
const constants = require(path.join(__dirname, '../../config/constants.json')); |
|
|
const constants = require(path.join(__dirname, '../../config/constants.json')); |
|
|
const ERR_CODE_UNAVAILABLE = 14; |
|
|
const ERR_CODE_UNAVAILABLE = 14; |
|
|
const ERR_CODE_UNIMPLEMENTED = 12; |
|
|
|
|
|
// VERIFY PUBKEY OF SENDER
|
|
|
// VERIFY PUBKEY OF SENDER
|
|
|
function parseAndVerifyPayload(data) { |
|
|
function parseAndVerifyPayload(data) { |
|
|
return __awaiter(this, void 0, void 0, function* () { |
|
|
return __awaiter(this, void 0, void 0, function* () { |
|
@ -185,7 +184,7 @@ function subscribeInvoices(actions) { |
|
|
call.on('status', function (status) { |
|
|
call.on('status', function (status) { |
|
|
console.log("Status", status); |
|
|
console.log("Status", status); |
|
|
// The server is unavailable, trying to reconnect.
|
|
|
// The server is unavailable, trying to reconnect.
|
|
|
if (status.code == ERR_CODE_UNAVAILABLE || status.code == ERR_CODE_UNIMPLEMENTED) { |
|
|
if (status.code == ERR_CODE_UNAVAILABLE) { |
|
|
reconnectToLND(); |
|
|
reconnectToLND(); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
@ -194,7 +193,12 @@ function subscribeInvoices(actions) { |
|
|
}); |
|
|
}); |
|
|
call.on('error', function (err) { |
|
|
call.on('error', function (err) { |
|
|
console.error(err); |
|
|
console.error(err); |
|
|
reject(err); |
|
|
if (err.code == ERR_CODE_UNAVAILABLE) { |
|
|
|
|
|
reconnectToLND(); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
reject(err); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
call.on('end', function () { |
|
|
call.on('end', function () { |
|
|
const now = moment().format('YYYY-MM-DD HH:mm:ss').trim(); |
|
|
const now = moment().format('YYYY-MM-DD HH:mm:ss').trim(); |
|
|