diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index 081442567..cd72d91e0 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -97,7 +97,7 @@ class Blocks { private getBlockExtended(block: IEsploraApi.Block, transactions: TransactionExtended[]): BlockExtended { const blockExtended: BlockExtended = Object.assign({}, block); - blockExtended.extra = { + blockExtended.extras = { reward: transactions[0].vout.reduce((acc, curr) => acc + curr.value, 0), coinbaseTx: transactionUtils.stripCoinbaseTransaction(transactions[0]), }; @@ -106,9 +106,9 @@ class Blocks { transactionsTmp.shift(); transactionsTmp.sort((a, b) => b.effectiveFeePerVsize - a.effectiveFeePerVsize); - blockExtended.extra.medianFee = transactionsTmp.length > 0 ? + blockExtended.extras.medianFee = transactionsTmp.length > 0 ? Common.median(transactionsTmp.map((tx) => tx.effectiveFeePerVsize)) : 0; - blockExtended.extra.feeRange = transactionsTmp.length > 0 ? + blockExtended.extras.feeRange = transactionsTmp.length > 0 ? Common.getFeesInRange(transactionsTmp, 8) : [0, 0]; return blockExtended; @@ -205,8 +205,8 @@ class Blocks { const blockExtended = this.getBlockExtended(block, transactions); let miner: PoolTag; - if (blockExtended?.extra?.coinbaseTx) { - miner = await this.$findBlockMiner(blockExtended.extra.coinbaseTx); + if (blockExtended?.extras?.coinbaseTx) { + miner = await this.$findBlockMiner(blockExtended.extras.coinbaseTx); } else { miner = await poolsRepository.$getUnknownPool(); } @@ -276,8 +276,8 @@ class Blocks { if (['mainnet', 'testnet', 'signet'].includes(config.MEMPOOL.NETWORK) === true) { let miner: PoolTag; - if (blockExtended?.extra?.coinbaseTx) { - miner = await this.$findBlockMiner(blockExtended.extra.coinbaseTx); + if (blockExtended?.extras?.coinbaseTx) { + miner = await this.$findBlockMiner(blockExtended.extras.coinbaseTx); } else { miner = await poolsRepository.$getUnknownPool(); } diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index 5478445df..53d74925d 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -380,8 +380,8 @@ class WebsocketHandler { mBlocks = mempoolBlocks.getMempoolBlocks(); } - if (block.extra) { - block.extra.matchRate = matchRate; + if (block.extras) { + block.extras.matchRate = matchRate; } this.wss.clients.forEach((client) => { diff --git a/backend/src/mempool.interfaces.ts b/backend/src/mempool.interfaces.ts index 17509b814..7dfcd3956 100644 --- a/backend/src/mempool.interfaces.ts +++ b/backend/src/mempool.interfaces.ts @@ -86,7 +86,7 @@ export interface BlockExtension { } export interface BlockExtended extends IEsploraApi.Block { - extra?: BlockExtension; + extras?: BlockExtension; } export interface TransactionMinerInfo { diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index 2d55fc1cb..fd9549845 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -42,7 +42,7 @@ class BlocksRepository { poolTag.id, 0, '[]', - block.extra ? block.extra.medianFee : 0, + block.extras ? block.extras.medianFee : 0, ]; await connection.query(query, params); diff --git a/frontend/src/app/components/block/block.component.html b/frontend/src/app/components/block/block.component.html index 4f6e1cc03..8970bd372 100644 --- a/frontend/src/app/components/block/block.component.html +++ b/frontend/src/app/components/block/block.component.html @@ -74,9 +74,9 @@
Median fee | -~{{ block?.extra?.medianFee | number:'1.0-0' }} sat/vB |
+ ~{{ block?.extras?.medianFee | number:'1.0-0' }} sat/vB |