From 543357f1db64b2b0e15f821766d3efad7eadcd99 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Tue, 1 Aug 2023 17:33:03 +0900 Subject: [PATCH] fix null coinbase fees in block summary --- backend/src/api/blocks.ts | 4 ++-- backend/src/api/common.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index 20c015f44..0372d30a3 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -701,7 +701,7 @@ class Blocks { // fill in missing transaction fee data from verboseBlock for (let i = 0; i < transactions.length; i++) { if (!transactions[i].fee && transactions[i].txid === verboseBlock.tx[i].txid) { - transactions[i].fee = verboseBlock.tx[i].fee * 100_000_000; + transactions[i].fee = (verboseBlock.tx[i].fee * 100_000_000) || 0; } } @@ -941,7 +941,7 @@ class Blocks { transactions: cpfpSummary.transactions.map(tx => { return { txid: tx.txid, - fee: tx.fee, + fee: tx.fee || 0, vsize: tx.vsize, value: Math.round(tx.vout.reduce((acc, vout) => acc + (vout.value ? vout.value : 0), 0)), rate: tx.effectiveFeePerVsize diff --git a/backend/src/api/common.ts b/backend/src/api/common.ts index cd9da3d2a..0e03fe32c 100644 --- a/backend/src/api/common.ts +++ b/backend/src/api/common.ts @@ -108,7 +108,7 @@ export class Common { static stripTransaction(tx: TransactionExtended): TransactionStripped { return { txid: tx.txid, - fee: tx.fee, + fee: tx.fee || 0, vsize: tx.weight / 4, value: tx.vout.reduce((acc, vout) => acc + (vout.value ? vout.value : 0), 0), rate: tx.effectiveFeePerVsize,