From 558c84b7e24bd0d8cb936262d705747663671ffe Mon Sep 17 00:00:00 2001 From: Overtorment Date: Sun, 10 May 2020 12:12:40 +0100 Subject: [PATCH] REF: script --- scripts/important-channels.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/important-channels.js b/scripts/important-channels.js index f500844..55b92c8 100644 --- a/scripts/important-channels.js +++ b/scripts/important-channels.js @@ -101,6 +101,27 @@ lightning.listChannels({}, function(err, response) { } } + if (process.argv.includes('--reconnect-all')) { + 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 && !doneReconnect[channel.remote_pubkey]) { + doneReconnect[channel.remote_pubkey] = true; + console.log( + 'lncli disconnect', + channel.remote_pubkey, + '; sleep 5;', + 'lncli connect', + important_channels[channel.remote_pubkey].uri, + '#', + important_channels[channel.remote_pubkey].name, + ); + } + } + } + } + if (process.argv.includes('--open')) { console.log('\n# open important channels:\n'); for (const important of Object.keys(important_channels)) {