From 73d65bb7b319660f3eb609e6c9b16bfaefccac9a Mon Sep 17 00:00:00 2001 From: Overtorment Date: Sun, 21 Feb 2021 12:26:40 +0000 Subject: [PATCH] FIX: bars --- controllers/api.js | 2 +- controllers/website.js | 16 ++++----- scripts/important-channels.js | 63 ++++++++++++++++++----------------- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/controllers/api.js b/controllers/api.js index 3e56a3f..20ffa39 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -41,7 +41,7 @@ lightning.getInfo({}, function (err, info) { console.info(info); if (!info.synced_to_chain) { console.error('lnd not synced'); - process.exit(4); + // process.exit(4); } identity_pubkey = info.identity_pubkey; } diff --git a/controllers/website.js b/controllers/website.js index 9fb38bd..bdb110a 100644 --- a/controllers/website.js +++ b/controllers/website.js @@ -25,15 +25,15 @@ function updateLightning() { } lightningListChannels = response; let channels = []; + let max_chan_capacity = -1; + for (const channel of lightningListChannels.channels) { + max_chan_capacity = Math.max(max_chan_capacity, channel.capacity); + } for (let channel of lightningListChannels.channels) { - let magic = 104287; - let divider = 0.01; - let ascii_length1 = channel.local_balance * divider; - let ascii_length2 = channel.remote_balance * divider; - channel.local = (Math.round(ascii_length1)); - channel.remote = (Math.round(ascii_length2)); - channel.total = (channel.local) + (channel.remote); - channel.size = (channel.capacity / magic); + let magic = max_chan_capacity / 100; + channel.local = channel.local_balance * 1; + channel.total = channel.capacity * 1; + channel.size = Math.round(channel.capacity / magic); // total size of the bar on page. 100% means it takes maximum width channel.capacity_btc = channel.capacity / 100000000; channel.name = pubkey2name[channel.remote_pubkey]; if (channel.name) { diff --git a/scripts/important-channels.js b/scripts/important-channels.js index f215052..b089278 100644 --- a/scripts/important-channels.js +++ b/scripts/important-channels.js @@ -2,6 +2,7 @@ const important_channels = { '03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f': { name: 'ACINQ', uri: '03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f@34.239.230.56:9735', + wumbo: 1, }, '03abf6f44c355dec0d5aa155bdbdd6e0c8fefe318eff402de65c6eb2e1be55dc3e': { name: 'OpenNode', @@ -12,45 +13,45 @@ const important_channels = { name: 'coingate.com', uri: '0242a4ae0c5bef18048fbecf995094b74bfb0f7391418d71ed394784373f41e4f3@3.124.63.44:9735', }, - '0254ff808f53b2f8c45e74b70430f336c6c76ba2f4af289f48d6086ae6e60462d3': { - name: 'bitrefill thor', - uri: '0254ff808f53b2f8c45e74b70430f336c6c76ba2f4af289f48d6086ae6e60462d3@52.30.63.2:9735', - wumbo: 1, - }, +// '0254ff808f53b2f8c45e74b70430f336c6c76ba2f4af289f48d6086ae6e60462d3': { +// name: 'bitrefill thor', +// uri: '0254ff808f53b2f8c45e74b70430f336c6c76ba2f4af289f48d6086ae6e60462d3@52.30.63.2:9735', +// wumbo: 1, +// }, '030c3f19d742ca294a55c00376b3b355c3c90d61c6b6b39554dbc7ac19b141c14f': { name: 'bitrefill 2', uri: '030c3f19d742ca294a55c00376b3b355c3c90d61c6b6b39554dbc7ac19b141c14f@52.50.244.44:9735', wumbo: 1, }, - '025f1456582e70c4c06b61d5c8ed3ce229e6d0db538be337a2dc6d163b0ebc05a5': { - name: 'paywithmoon.com', - uri: '025f1456582e70c4c06b61d5c8ed3ce229e6d0db538be337a2dc6d163b0ebc05a5@52.86.210.65:9735', - }, - '0279c22ed7a068d10dc1a38ae66d2d6461e269226c60258c021b1ddcdfe4b00bc4': { - name: 'ln1.satoshilabs.com', - uri: '0279c22ed7a068d10dc1a38ae66d2d6461e269226c60258c021b1ddcdfe4b00bc4@157.230.28.160:9735', - }, - '02004c625d622245606a1ea2c1c69cfb4516b703b47945a3647713c05fe4aaeb1c': { - name: 'LivingRoomOfSatoshi', - uri: '02004c625d622245606a1ea2c1c69cfb4516b703b47945a3647713c05fe4aaeb1c@172.81.178.151:9735', - }, +// '025f1456582e70c4c06b61d5c8ed3ce229e6d0db538be337a2dc6d163b0ebc05a5': { +// name: 'paywithmoon.com', +// uri: '025f1456582e70c4c06b61d5c8ed3ce229e6d0db538be337a2dc6d163b0ebc05a5@52.86.210.65:9735', +// }, +// '0279c22ed7a068d10dc1a38ae66d2d6461e269226c60258c021b1ddcdfe4b00bc4': { +// name: 'ln1.satoshilabs.com', +// uri: '0279c22ed7a068d10dc1a38ae66d2d6461e269226c60258c021b1ddcdfe4b00bc4@157.230.28.160:9735', +// }, +// '02004c625d622245606a1ea2c1c69cfb4516b703b47945a3647713c05fe4aaeb1c': { +// name: 'LivingRoomOfSatoshi', +// uri: '02004c625d622245606a1ea2c1c69cfb4516b703b47945a3647713c05fe4aaeb1c@172.81.178.151:9735', +// }, '02816caed43171d3c9854e3b0ab2cf0c42be086ff1bd4005acc2a5f7db70d83774': { name: 'ln.pizza aka fold', uri: '02816caed43171d3c9854e3b0ab2cf0c42be086ff1bd4005acc2a5f7db70d83774@35.238.153.25:9735', wumbo: 1, }, - '0331f80652fb840239df8dc99205792bba2e559a05469915804c08420230e23c7c': { - name: 'LightningPowerUsers.com', - uri: '0331f80652fb840239df8dc99205792bba2e559a05469915804c08420230e23c7c@34.200.181.109:9735', - }, - '033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025': { - name: 'bfx-lnd0', - uri: '033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025@34.65.85.39:9735', - }, - '037f990e61acee8a7697966afd29dd88f3b1f8a7b14d625c4f8742bd952003a590': { - name: 'fixedfloat.com', - uri: '037f990e61acee8a7697966afd29dd88f3b1f8a7b14d625c4f8742bd952003a590@185.5.53.91:9735', - }, +// '0331f80652fb840239df8dc99205792bba2e559a05469915804c08420230e23c7c': { +// name: 'LightningPowerUsers.com', +// uri: '0331f80652fb840239df8dc99205792bba2e559a05469915804c08420230e23c7c@34.200.181.109:9735', +// }, +// '033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025': { +// 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', @@ -142,7 +143,9 @@ lightning.listChannels({}, function (err, response) { '--connect', important_channels[important].uri.split('@')[1], '--local_amt', - important_channels[important].wumbo ? '167772150' : '16777215', + important_channels[important].wumbo ? '50000000' : '16777215', + '--remote_csv_delay 144', + '--sat_per_byte 10', '#', important_channels[important].name, );