From 09f5f552bfdcbc3b9ba37ce45475aeb161da6bdd Mon Sep 17 00:00:00 2001 From: softsimon Date: Tue, 2 Feb 2021 00:10:57 +0700 Subject: [PATCH] Don't display fee rating when block medianFee is empty to fix "overpaid by infinity". fixes #288 --- .../app/components/tx-fee-rating/tx-fee-rating.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/tx-fee-rating/tx-fee-rating.component.ts b/frontend/src/app/components/tx-fee-rating/tx-fee-rating.component.ts index 639822dda..a1a7b0b3c 100644 --- a/frontend/src/app/components/tx-fee-rating/tx-fee-rating.component.ts +++ b/frontend/src/app/components/tx-fee-rating/tx-fee-rating.component.ts @@ -28,7 +28,7 @@ export class TxFeeRatingComponent implements OnInit, OnChanges, OnDestroy { ngOnInit() { this.blocksSubscription = this.stateService.blocks$.subscribe(([block]) => { this.blocks.push(block); - if (this.tx.status.confirmed && this.tx.status.block_height === block.height) { + if (this.tx.status.confirmed && this.tx.status.block_height === block.height && block.medianFee > 0) { this.calculateRatings(block); this.cd.markForCheck(); } @@ -42,7 +42,7 @@ export class TxFeeRatingComponent implements OnInit, OnChanges, OnDestroy { } const foundBlock = this.blocks.find((b) => b.height === this.tx.status.block_height); - if (foundBlock) { + if (foundBlock && foundBlock.medianFee > 0) { this.calculateRatings(foundBlock); } } @@ -53,7 +53,7 @@ export class TxFeeRatingComponent implements OnInit, OnChanges, OnDestroy { calculateRatings(block: Block) { const feePervByte = this.tx.fee / (this.tx.weight / 4); - this.medianFeeNeeded = Math.round(block.feeRange[Math.round(block.feeRange.length * 0.5)]); + this.medianFeeNeeded = block.medianFee; // Block not filled if (block.weight < 4000000 * 0.95) {