From 15b7e75b69d03eb1db058e3986c94e6c7c424b4a Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 9 Oct 2024 16:33:19 +0900 Subject: [PATCH 1/2] Fix wrong timespan in acc timeline --- .../acceleration-timeline/acceleration-timeline.component.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts b/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts index 16fd24c7f..93001a66b 100644 --- a/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts +++ b/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts @@ -43,12 +43,10 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges { this.poolsData[pool.unique_id] = pool; } }); - - this.updateTimes(); - this.interval = window.setInterval(this.updateTimes.bind(this), 60000); } ngOnChanges(changes): void { + this.updateTimes(); // Hide standard ETA while we don't have a proper standard ETA calculation, see https://github.com/mempool/mempool/issues/65 // if (changes?.eta?.currentValue || changes?.standardETA?.currentValue || changes?.acceleratedETA?.currentValue) { From c4004ba301078221fc3bdaa86c3a1a47d9be1e6d Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 9 Oct 2024 17:50:24 +0900 Subject: [PATCH 2/2] Clean up timeline code --- .../acceleration-timeline.component.html | 4 +--- .../acceleration-timeline.component.ts | 20 ------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.html b/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.html index ba0d44884..ef3ace5ea 100644 --- a/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.html +++ b/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.html @@ -9,7 +9,7 @@
@if (eta) { - ~ + ~ }
@@ -48,8 +48,6 @@
- } @else if (standardETA && !tx.status.confirmed) { - } diff --git a/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts b/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts index 93001a66b..14f533a05 100644 --- a/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts +++ b/frontend/src/app/components/acceleration-timeline/acceleration-timeline.component.ts @@ -14,16 +14,11 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges { @Input() tx: Transaction; @Input() accelerationInfo: Acceleration; @Input() eta: ETA; - // A mined transaction has standard ETA and accelerated ETA undefined - // A transaction in mempool has either standardETA defined (if accelerated) or acceleratedETA defined (if not accelerated yet) - @Input() standardETA: number; - @Input() acceleratedETA: number; acceleratedAt: number; now: number; accelerateRatio: number; useAbsoluteTime: boolean = false; - interval: number; firstSeenToAccelerated: number; acceleratedToMined: number; @@ -47,17 +42,6 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges { ngOnChanges(changes): void { this.updateTimes(); - // Hide standard ETA while we don't have a proper standard ETA calculation, see https://github.com/mempool/mempool/issues/65 - - // if (changes?.eta?.currentValue || changes?.standardETA?.currentValue || changes?.acceleratedETA?.currentValue) { - // if (changes?.eta?.currentValue) { - // if (changes?.acceleratedETA?.currentValue) { - // this.accelerateRatio = Math.floor((Math.floor(changes.eta.currentValue.time / 1000) - this.now) / (Math.floor(changes.acceleratedETA.currentValue / 1000) - this.now)); - // } else if (changes?.standardETA?.currentValue) { - // this.accelerateRatio = Math.floor((Math.floor(changes.standardETA.currentValue / 1000) - this.now) / (Math.floor(changes.eta.currentValue.time / 1000) - this.now)); - // } - // } - // } } updateTimes(): void { @@ -66,10 +50,6 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges { this.firstSeenToAccelerated = Math.max(0, this.acceleratedAt - this.transactionTime); this.acceleratedToMined = Math.max(0, this.tx.status.block_time - this.acceleratedAt); } - - ngOnDestroy(): void { - clearInterval(this.interval); - } onHover(event, status: string): void { if (status === 'seen') {