From 9f40cba914aafc95f322ea4569460f5b33fbea4b Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sun, 12 Mar 2023 14:51:06 +0900 Subject: [PATCH] use new median fee calculation for mempool blocks --- backend/src/api/mempool-blocks.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/backend/src/api/mempool-blocks.ts b/backend/src/api/mempool-blocks.ts index 0d6186ce1..43ab16647 100644 --- a/backend/src/api/mempool-blocks.ts +++ b/backend/src/api/mempool-blocks.ts @@ -324,22 +324,14 @@ class MempoolBlocks { fitTransactions.push(tx); } }); - let rangeLength = 4; - if (blocksIndex === 0) { - rangeLength = 8; - } - if (transactions.length > 4000) { - rangeLength = 6; - } else if (transactions.length > 10000) { - rangeLength = 8; - } + const feeStats = Common.calcEffectiveFeeStatistics(transactions); return { blockSize: totalSize, blockVSize: totalWeight / 4, nTx: transactions.length, totalFees: transactions.reduce((acc, cur) => acc + cur.fee, 0), - medianFee: Common.percentile(transactions.map((tx) => tx.effectiveFeePerVsize), config.MEMPOOL.RECOMMENDED_FEE_PERCENTILE), - feeRange: Common.getFeesInRange(transactions, rangeLength), + medianFee: feeStats.medianFee, // Common.percentile(transactions.map((tx) => tx.effectiveFeePerVsize), config.MEMPOOL.RECOMMENDED_FEE_PERCENTILE), + feeRange: feeStats.feeRange, //Common.getFeesInRange(transactions, rangeLength), transactionIds: transactions.map((tx) => tx.txid), transactions: fitTransactions.map((tx) => Common.stripTransaction(tx)), };