diff --git a/backend/src/repositories/TransactionRepository.ts b/backend/src/repositories/TransactionRepository.ts index 2d05f0e14..fc6af973d 100644 --- a/backend/src/repositories/TransactionRepository.ts +++ b/backend/src/repositories/TransactionRepository.ts @@ -83,7 +83,6 @@ class TransactionRepository { return { descendants, ancestors, - effectiveFeePerVsize: cpfp.fee_rate }; } } diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 575c00637..81ae2f055 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -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, diff --git a/frontend/src/app/interfaces/node-api.interface.ts b/frontend/src/app/interfaces/node-api.interface.ts index 2e6b94988..f72886870 100644 --- a/frontend/src/app/interfaces/node-api.interface.ts +++ b/frontend/src/app/interfaces/node-api.interface.ts @@ -24,7 +24,6 @@ export interface CpfpInfo { ancestors: Ancestor[]; descendants?: Ancestor[]; bestDescendant?: BestDescendant | null; - effectiveFeePerVsize?: number; } export interface DifficultyAdjustment {