remove slow cpfp indexing path

This commit is contained in:
Mononaut committed 2023-01-11 08:44:10 -06:00
1 parent 0d921cf7a6
commit ee95d033ac
1 file changed
+7 -26
+7 -26
View File
@@ -753,32 +753,13 @@ class Blocks {
public async $indexCPFP(hash: string, height: number): Promise<void> { public async $indexCPFP(hash: string, height: number): Promise<void> {
let transactions; let transactions;
if (Common.blocksSummariesIndexingEnabled()) {
transactions = await this.$getStrippedBlockTransactions(hash); const block = await bitcoinClient.getBlock(hash, 2);
const rawBlock = await bitcoinApi.$getRawBlock(hash); transactions = block.tx.map(tx => {
const block = Block.fromBuffer(rawBlock); tx.vsize = tx.weight / 4;
const txMap = {}; tx.fee *= 100_000_000;
for (const tx of block.transactions || []) { return tx;
txMap[tx.getId()] = tx; });
}
for (const tx of transactions) {
// convert from bitcoinjs to esplora vin format
if (txMap[tx.txid]?.ins) {
tx.vin = txMap[tx.txid].ins.map(vin => {
return {
txid: vin.hash.slice().reverse().toString('hex')
};
});
}
}
} else {
const block = await bitcoinClient.getBlock(hash, 2);
transactions = block.tx.map(tx => {
tx.vsize = tx.weight / 4;
tx.fee *= 100_000_000;
return tx;
});
}
let cluster: TransactionStripped[] = []; let cluster: TransactionStripped[] = [];
let ancestors: { [txid: string]: boolean } = {}; let ancestors: { [txid: string]: boolean } = {};