clean up unused vars in mempool-blocks.ts
This commit is contained in:
		
							parent
							
								
									9f40cba914
								
							
						
					
					
						commit
						a4c027dc48
					
				| @ -59,7 +59,7 @@ class MempoolBlocks { | |||||||
|     // Loop through and traverse all ancestors and sum up all the sizes + fees
 |     // Loop through and traverse all ancestors and sum up all the sizes + fees
 | ||||||
|     // Pass down size + fee to all unconfirmed children
 |     // Pass down size + fee to all unconfirmed children
 | ||||||
|     let sizes = 0; |     let sizes = 0; | ||||||
|     memPoolArray.forEach((tx, i) => { |     memPoolArray.forEach((tx) => { | ||||||
|       sizes += tx.weight; |       sizes += tx.weight; | ||||||
|       if (sizes > 4000000 * 8) { |       if (sizes > 4000000 * 8) { | ||||||
|         return; |         return; | ||||||
| @ -74,7 +74,7 @@ class MempoolBlocks { | |||||||
|     const time = end - start; |     const time = end - start; | ||||||
|     logger.debug('Mempool blocks calculated in ' + time / 1000 + ' seconds'); |     logger.debug('Mempool blocks calculated in ' + time / 1000 + ' seconds'); | ||||||
| 
 | 
 | ||||||
|     const blocks = this.calculateMempoolBlocks(memPoolArray, this.mempoolBlocks); |     const blocks = this.calculateMempoolBlocks(memPoolArray); | ||||||
| 
 | 
 | ||||||
|     if (saveResults) { |     if (saveResults) { | ||||||
|       const deltas = this.calculateMempoolDeltas(this.mempoolBlocks, blocks); |       const deltas = this.calculateMempoolDeltas(this.mempoolBlocks, blocks); | ||||||
| @ -85,26 +85,23 @@ class MempoolBlocks { | |||||||
|     return blocks; |     return blocks; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   private calculateMempoolBlocks(transactionsSorted: TransactionExtended[], prevBlocks: MempoolBlockWithTransactions[]): MempoolBlockWithTransactions[] { |   private calculateMempoolBlocks(transactionsSorted: TransactionExtended[]): MempoolBlockWithTransactions[] { | ||||||
|     const mempoolBlocks: MempoolBlockWithTransactions[] = []; |     const mempoolBlocks: MempoolBlockWithTransactions[] = []; | ||||||
|     let blockWeight = 0; |     let blockWeight = 0; | ||||||
|     let blockSize = 0; |  | ||||||
|     let transactions: TransactionExtended[] = []; |     let transactions: TransactionExtended[] = []; | ||||||
|     transactionsSorted.forEach((tx) => { |     transactionsSorted.forEach((tx) => { | ||||||
|       if (blockWeight + tx.weight <= config.MEMPOOL.BLOCK_WEIGHT_UNITS |       if (blockWeight + tx.weight <= config.MEMPOOL.BLOCK_WEIGHT_UNITS | ||||||
|         || mempoolBlocks.length === config.MEMPOOL.MEMPOOL_BLOCKS_AMOUNT - 1) { |         || mempoolBlocks.length === config.MEMPOOL.MEMPOOL_BLOCKS_AMOUNT - 1) { | ||||||
|         blockWeight += tx.weight; |         blockWeight += tx.weight; | ||||||
|         blockSize += tx.size; |  | ||||||
|         transactions.push(tx); |         transactions.push(tx); | ||||||
|       } else { |       } else { | ||||||
|         mempoolBlocks.push(this.dataToMempoolBlocks(transactions, mempoolBlocks.length)); |         mempoolBlocks.push(this.dataToMempoolBlocks(transactions)); | ||||||
|         blockWeight = tx.weight; |         blockWeight = tx.weight; | ||||||
|         blockSize = tx.size; |  | ||||||
|         transactions = [tx]; |         transactions = [tx]; | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|     if (transactions.length) { |     if (transactions.length) { | ||||||
|       mempoolBlocks.push(this.dataToMempoolBlocks(transactions, mempoolBlocks.length)); |       mempoolBlocks.push(this.dataToMempoolBlocks(transactions)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return mempoolBlocks; |     return mempoolBlocks; | ||||||
| @ -298,10 +295,10 @@ class MempoolBlocks { | |||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     // unpack the condensed blocks into proper mempool blocks
 |     // unpack the condensed blocks into proper mempool blocks
 | ||||||
|     const mempoolBlocks = blocks.map((transactions, blockIndex) => { |     const mempoolBlocks = blocks.map((transactions) => { | ||||||
|       return this.dataToMempoolBlocks(transactions.map(tx => { |       return this.dataToMempoolBlocks(transactions.map(tx => { | ||||||
|         return mempool[tx.txid] || null; |         return mempool[tx.txid] || null; | ||||||
|       }).filter(tx => !!tx), blockIndex); |       }).filter(tx => !!tx)); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     if (saveResults) { |     if (saveResults) { | ||||||
| @ -313,7 +310,7 @@ class MempoolBlocks { | |||||||
|     return mempoolBlocks; |     return mempoolBlocks; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   private dataToMempoolBlocks(transactions: TransactionExtended[], blocksIndex: number): MempoolBlockWithTransactions { |   private dataToMempoolBlocks(transactions: TransactionExtended[]): MempoolBlockWithTransactions { | ||||||
|     let totalSize = 0; |     let totalSize = 0; | ||||||
|     let totalWeight = 0; |     let totalWeight = 0; | ||||||
|     const fitTransactions: TransactionExtended[] = []; |     const fitTransactions: TransactionExtended[] = []; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user