diff --git a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts index 561f01585..a72d24899 100644 --- a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts +++ b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts @@ -143,6 +143,8 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy { this.mempoolBlocksFull = JSON.parse(stringifiedBlocks); this.mempoolBlocks = this.reduceMempoolBlocksToFitScreen(JSON.parse(stringifiedBlocks)); + this.now = Date.now(); + this.updateMempoolBlockStyles(); this.calculateTransactionPosition(); return this.mempoolBlocks; @@ -152,7 +154,8 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy { this.difficultyAdjustments$ = this.stateService.difficultyAdjustment$ .pipe( map((da) => { - this.now = new Date().getTime(); + this.now = Date.now(); + this.cd.markForCheck(); return da; }) ); diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index a5a44ee90..216114cd0 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -105,7 +105,7 @@ - + diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index dd32b05e8..e7fbaa913 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -19,7 +19,7 @@ import { WebsocketService } from '../../services/websocket.service'; import { AudioService } from '../../services/audio.service'; import { ApiService } from '../../services/api.service'; import { SeoService } from '../../services/seo.service'; -import { BlockExtended, CpfpInfo, RbfTree, MempoolPosition } from '../../interfaces/node-api.interface'; +import { BlockExtended, CpfpInfo, RbfTree, MempoolPosition, DifficultyAdjustment } from '../../interfaces/node-api.interface'; import { LiquidUnblinding } from './liquid-ublinding'; import { RelativeUrlPipe } from '../../shared/pipes/relative-url/relative-url.pipe'; import { Price, PriceService } from '../../services/price.service'; @@ -65,7 +65,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { fetchCachedTx$ = new Subject(); isCached: boolean = false; now = Date.now(); - timeAvg$: Observable; + da$: Observable; liquidUnblinding = new LiquidUnblinding(); inputIndex: number; outputIndex: number; @@ -117,11 +117,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.setFlowEnabled(); }); - this.timeAvg$ = timer(0, 1000) - .pipe( - switchMap(() => this.stateService.difficultyAdjustment$), - map((da) => da.timeAvg) - ); + this.da$ = this.stateService.difficultyAdjustment$.pipe( + tap(() => { + this.now = Date.now(); + }) + ); this.urlFragmentSubscription = this.route.fragment.subscribe((fragment) => { this.fragmentParams = new URLSearchParams(fragment || ''); @@ -236,6 +236,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { }); this.mempoolPositionSubscription = this.stateService.mempoolTxPosition$.subscribe(txPosition => { + this.now = Date.now(); if (txPosition && txPosition.txid === this.txId && txPosition.position) { this.mempoolPosition = txPosition.position; if (this.tx && !this.tx.status.confirmed) { @@ -434,12 +435,12 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { }); this.mempoolBlocksSubscription = this.stateService.mempoolBlocks$.subscribe((mempoolBlocks) => { + this.now = Date.now(); + if (!this.tx || this.mempoolPosition) { return; } - this.now = Date.now(); - const txFeePerVSize = this.tx.effectiveFeePerVsize || this.tx.fee / (this.tx.weight / 4);