From 2f5c487f8afb9995246a8e085d3221cfcdf74184 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Wed, 6 May 2020 11:17:38 +0100 Subject: [PATCH] FIX: important channels & process locked reduced to 1 day max --- scripts/important-channels.js | 12 +++++++++++- scripts/process-locked-payments.js | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/important-channels.js b/scripts/important-channels.js index b687d81..f500844 100644 --- a/scripts/important-channels.js +++ b/scripts/important-channels.js @@ -47,6 +47,14 @@ const important_channels = { name: 'bfx-lnd0', uri: '033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025@34.65.85.39:9735', }, + '037f990e61acee8a7697966afd29dd88f3b1f8a7b14d625c4f8742bd952003a590': { + name: 'fixedfloat.com', + uri: '037f990e61acee8a7697966afd29dd88f3b1f8a7b14d625c4f8742bd952003a590@185.5.53.91:9735', + }, + '03c2abfa93eacec04721c019644584424aab2ba4dff3ac9bdab4e9c97007491dda': { + name: 'tippin.me', + uri: '03c2abfa93eacec04721c019644584424aab2ba4dff3ac9bdab4e9c97007491dda@157.245.68.47:9735', + }, }; let lightning = require('../lightning'); @@ -73,10 +81,12 @@ lightning.listChannels({}, function(err, response) { } if (process.argv.includes('--reconnect')) { + let doneReconnect = {}; // so theres no duplicates console.log('# reconnect important channels that are inactive:\n'); for (const important of Object.keys(important_channels)) { for (let channel of lightningListChannels.channels) { - if (channel.remote_pubkey === important && !channel.active) { + if (channel.remote_pubkey === important && !channel.active && !doneReconnect[channel.remote_pubkey]) { + doneReconnect[channel.remote_pubkey] = true; console.log( 'lncli disconnect', channel.remote_pubkey, diff --git a/scripts/process-locked-payments.js b/scripts/process-locked-payments.js index beb1969..e56f115 100644 --- a/scripts/process-locked-payments.js +++ b/scripts/process-locked-payments.js @@ -38,7 +38,7 @@ let lightning = require('../lightning'); let payment = new Paym(redis, bitcoinclient, lightning); payment.setInvoice(lockedPayment.pay_req); - if (daysPassed < 2) { + if (daysPassed <= 1) { // if (!await payment.isExpired()) { let sendResult; console.log('attempting to pay to route'); @@ -67,7 +67,7 @@ let lightning = require('../lightning'); console.log('sleeping 5 sec...'); console.log('-----------------------------------------------------------------------------------'); await User._sleep(0); - } else if (daysPassed > 4) { + } else if (daysPassed > 1) { // trying to lookup this stuck payment in an array of delivered payments let isPaid = false; for (let sentPayment of listPayments['payments']) {