From 645fd98c3025c7eb91db454e4849e24963fe57b8 Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 10 Jul 2024 23:21:53 +0900 Subject: [PATCH 1/3] Show actual accelerated fee rate on newly mined tracked tx --- .../src/app/components/transaction/transaction.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 557bc1b14..22916b242 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -639,7 +639,7 @@ }
- @if (accelerationInfo?.acceleratedFeeRate && (!tx.effectiveFeePerVsize || accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize)) { + @if (accelerationInfo?.acceleratedFeeRate && (!tx.effectiveFeePerVsize || accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize || tx.acceleration)) { } @else { From 4470461a98c7615398abf7bce612a2f302916592 Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 10 Jul 2024 23:22:57 +0900 Subject: [PATCH 2/3] Add retry logic to acceleration data fetching on tx page --- .../transaction/transaction.component.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index acc05a250..487dff698 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -317,11 +317,19 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.setIsAccelerated(); }), switchMap((blockHeight: number) => { - return this.servicesApiService.getAccelerationHistory$({ blockHeight }); + return this.servicesApiService.getAccelerationHistory$({ blockHeight }).pipe( + switchMap((accelerationHistory: Acceleration[]) => { + if (this.tx.acceleration && !accelerationHistory.length) { // If the just mined transaction was accelerated, but services backend did not return any acceleration data, retry + return throwError('retry'); + } + return of(accelerationHistory); + }), + retry({ count: 3, delay: 2000 }), + catchError(() => { + return of([]); + }) + ); }), - catchError(() => { - return of([]); - }) ).subscribe((accelerationHistory) => { for (const acceleration of accelerationHistory) { if (acceleration.txid === this.txId && (acceleration.status === 'completed' || acceleration.status === 'completed_provisional')) { From bbff50527b6e438f728f8ddfed4133b6d91817bd Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 10 Jul 2024 22:29:26 +0900 Subject: [PATCH 3/3] Don't show Accelerated on tx just mined by non-participating pool --- .../app/components/transaction/transaction.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 487dff698..fcf86b1dc 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -132,6 +132,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { tooltipPosition: { x: number, y: number }; isMobile: boolean; firstLoad = true; + waitingForAccelerationInfo: boolean = false; featuresEnabled: boolean; segwitEnabled: boolean; @@ -338,6 +339,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { acceleration.boost = boostCost; this.tx.acceleratedAt = acceleration.added; this.accelerationInfo = acceleration; + this.waitingForAccelerationInfo = false; this.setIsAccelerated(); } } @@ -616,6 +618,9 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.stateService.txConfirmed$.subscribe(([txConfirmed, block]) => { if (txConfirmed && this.tx && !this.tx.status.confirmed && txConfirmed === this.tx.txid) { + if (this.tx.acceleration) { + this.waitingForAccelerationInfo = true; + } this.tx.status = { confirmed: true, block_height: block.height, @@ -812,7 +817,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { } setIsAccelerated(initialState: boolean = false) { - this.isAcceleration = (this.tx.acceleration || (this.accelerationInfo && this.pool && this.accelerationInfo.pools.some(pool => (pool === this.pool.id)))); + this.isAcceleration = ((this.tx.acceleration && (!this.tx.status.confirmed || this.waitingForAccelerationInfo)) || (this.accelerationInfo && this.pool && this.accelerationInfo.pools.some(pool => (pool === this.pool.id)))); if (this.isAcceleration) { if (initialState) { this.accelerationFlowCompleted = true;