Compare commits
4 Commits
mononaut/p
...
mononaut/p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7569c6a394 | ||
|
|
d67285c683 | ||
|
|
2b7ac32c22 | ||
|
|
df596ab5bf |
@@ -18,15 +18,20 @@ if (parentPort) {
|
||||
}
|
||||
|
||||
async function indexBlockSummary(hash: string, height: number): Promise<void> {
|
||||
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);
|
||||
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;
|
||||
});
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user