Fix typo which skips sigop calculation
This commit is contained in:
		
							parent
							
								
									caa8cfbc0e
								
							
						
					
					
						commit
						44f2217a68
					
				@ -86,7 +86,7 @@ class Mempool {
 | 
				
			|||||||
    this.mempoolCache = mempoolData;
 | 
					    this.mempoolCache = mempoolData;
 | 
				
			||||||
    let count = 0;
 | 
					    let count = 0;
 | 
				
			||||||
    for (const txid of Object.keys(this.mempoolCache)) {
 | 
					    for (const txid of Object.keys(this.mempoolCache)) {
 | 
				
			||||||
      if (this.mempoolCache[txid].sigops == null || this.mempoolCache[txid].effectiveFeePerVsize == null) {
 | 
					      if (!this.mempoolCache[txid].sigops || this.mempoolCache[txid].effectiveFeePerVsize == null) {
 | 
				
			||||||
        this.mempoolCache[txid] = transactionUtils.extendMempoolTransaction(this.mempoolCache[txid]);
 | 
					        this.mempoolCache[txid] = transactionUtils.extendMempoolTransaction(this.mempoolCache[txid]);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (this.mempoolCache[txid].order == null) {
 | 
					      if (this.mempoolCache[txid].order == null) {
 | 
				
			||||||
 | 
				
			|||||||
@ -74,7 +74,7 @@ class TransactionUtils {
 | 
				
			|||||||
  public extendMempoolTransaction(transaction: IEsploraApi.Transaction): MempoolTransactionExtended {
 | 
					  public extendMempoolTransaction(transaction: IEsploraApi.Transaction): MempoolTransactionExtended {
 | 
				
			||||||
    const vsize = Math.ceil(transaction.weight / 4);
 | 
					    const vsize = Math.ceil(transaction.weight / 4);
 | 
				
			||||||
    const fractionalVsize = (transaction.weight / 4);
 | 
					    const fractionalVsize = (transaction.weight / 4);
 | 
				
			||||||
    const sigops = Common.isLiquid() ? this.countSigops(transaction) : 0;
 | 
					    const sigops = !Common.isLiquid() ? this.countSigops(transaction) : 0;
 | 
				
			||||||
    // https://github.com/bitcoin/bitcoin/blob/e9262ea32a6e1d364fb7974844fadc36f931f8c6/src/policy/policy.cpp#L295-L298
 | 
					    // https://github.com/bitcoin/bitcoin/blob/e9262ea32a6e1d364fb7974844fadc36f931f8c6/src/policy/policy.cpp#L295-L298
 | 
				
			||||||
    const adjustedVsize = Math.max(fractionalVsize, sigops *  5); // adjusted vsize = Max(weight, sigops * bytes_per_sigop) / witness_scale_factor
 | 
					    const adjustedVsize = Math.max(fractionalVsize, sigops *  5); // adjusted vsize = Max(weight, sigops * bytes_per_sigop) / witness_scale_factor
 | 
				
			||||||
    const feePerVbytes = (transaction.fee || 0) / fractionalVsize;
 | 
					    const feePerVbytes = (transaction.fee || 0) / fractionalVsize;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user