Merge pull request #5578 from mempool/natsoni/fix-timeline
Fix wrong timespan on acceleration timeline
This commit is contained in:
commit
05f60cda56
@ -9,7 +9,7 @@
|
|||||||
<div class="interval">
|
<div class="interval">
|
||||||
<div class="interval-time">
|
<div class="interval-time">
|
||||||
@if (eta) {
|
@if (eta) {
|
||||||
~<app-time [time]="eta?.wait / 1000"></app-time> <!-- <span *ngIf="accelerateRatio > 1" class="compare"> ({{ accelerateRatio }}x faster)</span> -->
|
~<app-time [time]="eta?.wait / 1000"></app-time>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -48,8 +48,6 @@
|
|||||||
<div class="interval-time">
|
<div class="interval-time">
|
||||||
<app-time [time]="acceleratedToMined"></app-time>
|
<app-time [time]="acceleratedToMined"></app-time>
|
||||||
</div>
|
</div>
|
||||||
} @else if (standardETA && !tx.status.confirmed) {
|
|
||||||
<!-- ~<app-time [time]="standardETA / 1000 - now"></app-time> -->
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,16 +14,11 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
|
|||||||
@Input() tx: Transaction;
|
@Input() tx: Transaction;
|
||||||
@Input() accelerationInfo: Acceleration;
|
@Input() accelerationInfo: Acceleration;
|
||||||
@Input() eta: ETA;
|
@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;
|
acceleratedAt: number;
|
||||||
now: number;
|
now: number;
|
||||||
accelerateRatio: number;
|
accelerateRatio: number;
|
||||||
useAbsoluteTime: boolean = false;
|
useAbsoluteTime: boolean = false;
|
||||||
interval: number;
|
|
||||||
firstSeenToAccelerated: number;
|
firstSeenToAccelerated: number;
|
||||||
acceleratedToMined: number;
|
acceleratedToMined: number;
|
||||||
|
|
||||||
@ -43,23 +38,10 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
|
|||||||
this.poolsData[pool.unique_id] = pool;
|
this.poolsData[pool.unique_id] = pool;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.updateTimes();
|
|
||||||
this.interval = window.setInterval(this.updateTimes.bind(this), 60000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes): void {
|
ngOnChanges(changes): void {
|
||||||
// Hide standard ETA while we don't have a proper standard ETA calculation, see https://github.com/mempool/mempool/issues/65
|
this.updateTimes();
|
||||||
|
|
||||||
// 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 {
|
updateTimes(): void {
|
||||||
@ -68,10 +50,6 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
|
|||||||
this.firstSeenToAccelerated = Math.max(0, this.acceleratedAt - this.transactionTime);
|
this.firstSeenToAccelerated = Math.max(0, this.acceleratedAt - this.transactionTime);
|
||||||
this.acceleratedToMined = Math.max(0, this.tx.status.block_time - this.acceleratedAt);
|
this.acceleratedToMined = Math.max(0, this.tx.status.block_time - this.acceleratedAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
clearInterval(this.interval);
|
|
||||||
}
|
|
||||||
|
|
||||||
onHover(event, status: string): void {
|
onHover(event, status: string): void {
|
||||||
if (status === 'seen') {
|
if (status === 'seen') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user