Small cleanup

This commit is contained in:
nymkappa 2022-08-02 15:58:29 +02:00
parent 5d7e42195f
commit d7f2f4136c
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -151,9 +151,11 @@ class LightningStatsImporter {
const alreadyCountedChannels = {}; const alreadyCountedChannels = {};
for (const channel of networkGraph.channels) { for (const channel of networkGraph.channels) {
const tx = await fundingTxFetcher.$fetchChannelOpenTx(channel.scid.slice(0, -2)); const short_id = channel.scid.slice(0, -2);
const tx = await fundingTxFetcher.$fetchChannelOpenTx(short_id);
if (!tx) { if (!tx) {
logger.err(`Unable to fetch funding tx for channel ${channel.scid}. Capacity and creation date will stay unknown.`); logger.err(`Unable to fetch funding tx for channel ${short_id}. Capacity and creation date is unknown. Skipping channel.`);
continue; continue;
} }
@ -175,10 +177,10 @@ class LightningStatsImporter {
nodeStats[channel.destination].capacity += Math.round(tx.value * 100000000); nodeStats[channel.destination].capacity += Math.round(tx.value * 100000000);
nodeStats[channel.destination].channels++; nodeStats[channel.destination].channels++;
if (!alreadyCountedChannels[channel.scid.slice(0, -2)]) { if (!alreadyCountedChannels[short_id]) {
capacity += Math.round(tx.value * 100000000); capacity += Math.round(tx.value * 100000000);
capacities.push(Math.round(tx.value * 100000000)); capacities.push(Math.round(tx.value * 100000000));
alreadyCountedChannels[channel.scid.slice(0, -2)] = true; alreadyCountedChannels[short_id] = true;
} }
avgFeeRate += channel.fee_proportional_millionths; avgFeeRate += channel.fee_proportional_millionths;