From e3bc33e41b09f1d78736b2ae4f5300fa38034e64 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Wed, 2 Aug 2023 20:09:02 +0900 Subject: [PATCH] Always use Core verbose block for summaries indexing --- .../src/index-workers/block-summary-worker.ts | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/backend/src/index-workers/block-summary-worker.ts b/backend/src/index-workers/block-summary-worker.ts index 9ceb7bd88..5e0cea8e1 100644 --- a/backend/src/index-workers/block-summary-worker.ts +++ b/backend/src/index-workers/block-summary-worker.ts @@ -18,20 +18,15 @@ if (parentPort) { } async function indexBlockSummary(hash: string, height: number): Promise { - let txs; - if (config.MEMPOOL.BACKEND === 'esplora') { - txs = (await bitcoinApi.$getTxsForBlock(hash)).map(tx => transactionUtils.extendTransaction(tx)); - } else { - const block = await bitcoinClient.getBlock(hash, 2); - txs = block.tx.map(tx => { - tx.fee = Math.round(tx.fee * 100_000_000); - tx.vout.forEach((vout) => { - vout.value = Math.round(vout.value * 100000000); - }); - tx.vsize = Math.round(tx.weight / 4); // required for backwards compatibility - return tx; + const block = await bitcoinClient.getBlock(hash, 2); + const txs = block.tx.map(tx => { + tx.fee = Math.round(tx.fee * 100_000_000); + tx.vout.forEach((vout) => { + vout.value = Math.round(vout.value * 100000000); }); - } + tx.vsize = Math.round(tx.weight / 4); // required for backwards compatibility + return tx; + }); const cpfpSummary = await blocks.$indexCPFP(hash, height, txs); await blocks.$getStrippedBlockTransactions(hash, true, true, cpfpSummary, height); // This will index the block summary