From dbd205b73f9a63bc6e073dbb5e893c91741e7c3c Mon Sep 17 00:00:00 2001 From: softsimon Date: Sun, 8 Aug 2021 14:17:18 +0300 Subject: [PATCH] Fix: Block fee data wasn't visible unless at least 2 transactions. --- backend/src/api/blocks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index 7896fb30d..b09a5ac06 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -110,8 +110,8 @@ class Blocks { blockExtended.coinbaseTx = transactionUtils.stripCoinbaseTransaction(transactions[0]); transactions.shift(); transactions.sort((a, b) => b.effectiveFeePerVsize - a.effectiveFeePerVsize); - blockExtended.medianFee = transactions.length > 1 ? Common.median(transactions.map((tx) => tx.effectiveFeePerVsize)) : 0; - blockExtended.feeRange = transactions.length > 1 ? Common.getFeesInRange(transactions, 8) : [0, 0]; + blockExtended.medianFee = transactions.length > 0 ? Common.median(transactions.map((tx) => tx.effectiveFeePerVsize)) : 0; + blockExtended.feeRange = transactions.length > 0 ? Common.getFeesInRange(transactions, 8) : [0, 0]; if (block.height % 2016 === 0) { this.previousDifficultyRetarget = (block.difficulty - this.currentDifficulty) / this.currentDifficulty * 100;