Fix frontend logic for displaying effective fee rate
This commit is contained in:
		
							parent
							
								
									2b10a9121c
								
							
						
					
					
						commit
						dd4aa48b90
					
				@ -485,11 +485,11 @@
 | 
			
		||||
          {{ tx.feePerVsize | feeRounding }} <span class="symbol" i18n="shared.sat-vbyte|sat/vB">sat/vB</span>
 | 
			
		||||
          <ng-template [ngIf]="tx?.status?.confirmed">
 | 
			
		||||
             
 | 
			
		||||
            <app-tx-fee-rating *ngIf="tx.fee && (!cpfpInfo || (!cpfpInfo.effectiveFeePerVsize && !cpfpInfo?.descendants?.length && !cpfpInfo?.bestDescendant && !cpfpInfo?.ancestors?.length))" [tx]="tx"></app-tx-fee-rating>
 | 
			
		||||
            <app-tx-fee-rating *ngIf="tx.fee && !hasEffectiveFeeRate" [tx]="tx"></app-tx-fee-rating>
 | 
			
		||||
          </ng-template>
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
      <tr *ngIf="cpfpInfo && (cpfpInfo.effectiveFeePerVsize || cpfpInfo.bestDescendant || cpfpInfo.descendants?.length || cpfpInfo.ancestors?.length)">
 | 
			
		||||
      <tr *ngIf="cpfpInfo && hasEffectiveFeeRate">
 | 
			
		||||
        <td i18n="transaction.effective-fee-rate|Effective transaction fee rate">Effective fee rate</td>
 | 
			
		||||
        <td>
 | 
			
		||||
          <div class="effective-fee-container">
 | 
			
		||||
 | 
			
		||||
@ -86,6 +86,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
  segwitEnabled: boolean;
 | 
			
		||||
  rbfEnabled: boolean;
 | 
			
		||||
  taprootEnabled: boolean;
 | 
			
		||||
  hasEffectiveFeeRate: boolean;
 | 
			
		||||
 | 
			
		||||
  @ViewChild('graphContainer')
 | 
			
		||||
  graphContainer: ElementRef;
 | 
			
		||||
@ -157,6 +158,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
      .subscribe((cpfpInfo) => {
 | 
			
		||||
        if (!cpfpInfo || !this.tx) {
 | 
			
		||||
          this.cpfpInfo = null;
 | 
			
		||||
          this.hasEffectiveFeeRate = false;
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
        // merge ancestors/descendants
 | 
			
		||||
@ -164,7 +166,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
        if (cpfpInfo.bestDescendant && !cpfpInfo.descendants?.length) {
 | 
			
		||||
          relatives.push(cpfpInfo.bestDescendant);
 | 
			
		||||
        }
 | 
			
		||||
        if (!cpfpInfo.effectiveFeePerVsize) {
 | 
			
		||||
        const hasRelatives = !!relatives.length;
 | 
			
		||||
        if (!cpfpInfo.effectiveFeePerVsize && hasRelatives) {
 | 
			
		||||
          let totalWeight =
 | 
			
		||||
            this.tx.weight +
 | 
			
		||||
            relatives.reduce((prev, val) => prev + val.weight, 0);
 | 
			
		||||
@ -177,6 +180,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.cpfpInfo = cpfpInfo;
 | 
			
		||||
        this.hasEffectiveFeeRate = hasRelatives || (this.tx.effectiveFeePerVsize && (Math.abs(this.tx.effectiveFeePerVsize - this.tx.feePerVsize) > 0.01));
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
    this.fetchRbfSubscription = this.fetchRbfHistory$
 | 
			
		||||
@ -362,6 +366,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
                ancestors: tx.ancestors,
 | 
			
		||||
                bestDescendant: tx.bestDescendant,
 | 
			
		||||
              };
 | 
			
		||||
              const hasRelatives = !!(tx.ancestors.length || tx.bestDescendant);
 | 
			
		||||
              this.hasEffectiveFeeRate = hasRelatives || (tx.effectiveFeePerVsize && (Math.abs(tx.effectiveFeePerVsize - tx.feePerVsize) > 0.01));
 | 
			
		||||
            } else {
 | 
			
		||||
              this.fetchCpfp$.next(this.tx.txid);
 | 
			
		||||
            }
 | 
			
		||||
@ -503,6 +509,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
    this.replaced = false;
 | 
			
		||||
    this.transactionTime = -1;
 | 
			
		||||
    this.cpfpInfo = null;
 | 
			
		||||
    this.hasEffectiveFeeRate = false;
 | 
			
		||||
    this.rbfInfo = null;
 | 
			
		||||
    this.rbfReplaces = [];
 | 
			
		||||
    this.showCpfpDetails = false;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user