From 38c890626be82090569a9455777c9d41dae03e59 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Thu, 1 Dec 2022 11:34:44 +0900 Subject: [PATCH] fix CPFP handling in transaction preview --- .../transaction-preview.component.ts | 36 +++---------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction-preview.component.ts b/frontend/src/app/components/transaction/transaction-preview.component.ts index bd4260244..9d2d502b4 100644 --- a/frontend/src/app/components/transaction/transaction-preview.component.ts +++ b/frontend/src/app/components/transaction/transaction-preview.component.ts @@ -63,40 +63,14 @@ export class TransactionPreviewComponent implements OnInit, OnDestroy { this.fetchCpfpSubscription = this.fetchCpfp$ .pipe( switchMap((txId) => - this.apiService - .getCpfpinfo$(txId) - .pipe(retryWhen((errors) => errors.pipe(delay(2000)))) + this.apiService.getCpfpinfo$(txId).pipe( + catchError((err) => { + return of(null); + }) + ) ) ) .subscribe((cpfpInfo) => { - if (!this.tx) { - 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; - } - - this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4); - } - if (!this.tx.status.confirmed) { - this.stateService.markBlock$.next({ - txFeePerVSize: this.tx.effectiveFeePerVsize, - }); - } this.cpfpInfo = cpfpInfo; this.openGraphService.waitOver('cpfp-data-' + this.txId); });