remove redundant fields from CPFP interfaces
This commit is contained in:
		
							parent
							
								
									01c96f80f9
								
							
						
					
					
						commit
						fcd047f302
					
				@ -83,7 +83,6 @@ class TransactionRepository {
 | 
			
		||||
    return {
 | 
			
		||||
      descendants,
 | 
			
		||||
      ancestors,
 | 
			
		||||
      effectiveFeePerVsize: cpfp.fee_rate
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -131,26 +131,17 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
          this.cpfpInfo = null;
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
        if (cpfpInfo.effectiveFeePerVsize) {
 | 
			
		||||
          this.tx.effectiveFeePerVsize = cpfpInfo.effectiveFeePerVsize;
 | 
			
		||||
        } else {
 | 
			
		||||
          const lowerFeeParents = cpfpInfo.ancestors.filter(
 | 
			
		||||
            (parent) => parent.fee / (parent.weight / 4) < this.tx.feePerVsize
 | 
			
		||||
          );
 | 
			
		||||
          let totalWeight =
 | 
			
		||||
            this.tx.weight +
 | 
			
		||||
            lowerFeeParents.reduce((prev, val) => prev + val.weight, 0);
 | 
			
		||||
          let totalFees =
 | 
			
		||||
            this.tx.fee +
 | 
			
		||||
            lowerFeeParents.reduce((prev, val) => prev + val.fee, 0);
 | 
			
		||||
 | 
			
		||||
          if (cpfpInfo?.bestDescendant) {
 | 
			
		||||
            totalWeight += cpfpInfo?.bestDescendant.weight;
 | 
			
		||||
            totalFees += cpfpInfo?.bestDescendant.fee;
 | 
			
		||||
          }
 | 
			
		||||
        const relatives = [...cpfpInfo.ancestors, ...cpfpInfo.descendants || [cpfpInfo.bestDescendant]];
 | 
			
		||||
        let totalWeight =
 | 
			
		||||
          this.tx.weight +
 | 
			
		||||
          relatives.reduce((prev, val) => prev + val.weight, 0);
 | 
			
		||||
        let totalFees =
 | 
			
		||||
          this.tx.fee +
 | 
			
		||||
          relatives.reduce((prev, val) => prev + val.fee, 0);
 | 
			
		||||
 | 
			
		||||
        this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
 | 
			
		||||
 | 
			
		||||
          this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
 | 
			
		||||
        }
 | 
			
		||||
        if (!this.tx.status.confirmed) {
 | 
			
		||||
          this.stateService.markBlock$.next({
 | 
			
		||||
            txFeePerVSize: this.tx.effectiveFeePerVsize,
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,6 @@ export interface CpfpInfo {
 | 
			
		||||
  ancestors: Ancestor[];
 | 
			
		||||
  descendants?: Ancestor[];
 | 
			
		||||
  bestDescendant?: BestDescendant | null;
 | 
			
		||||
  effectiveFeePerVsize?: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface DifficultyAdjustment {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user