Always use Core verbose block for summaries indexing

This commit is contained in:
Mononaut 2023-08-02 20:09:02 +09:00
parent 20a8725450
commit e3bc33e41b
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -18,20 +18,15 @@ if (parentPort) {
}
async function indexBlockSummary(hash: string, height: number): Promise<void> {
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