From 13bcc99095e8a6dc74fb7535061d77007de2ee35 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 8 Apr 2024 13:43:54 +0000 Subject: [PATCH 1/3] Fix block summary data fields --- backend/src/api/blocks.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index f83b9ac2d..16ae94f66 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -976,6 +976,9 @@ class Blocks { if (this.blocks.length > config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4) { this.blocks = this.blocks.slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4); } + blockSummary.transactions.forEach(tx => { + delete tx.acc; + }); this.blockSummaries.push(blockSummary); if (this.blockSummaries.length > config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4) { this.blockSummaries = this.blockSummaries.slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4); @@ -1119,6 +1122,7 @@ class Blocks { } return { txid: tx.txid, + time: tx.firstSeen, fee: tx.fee || 0, vsize: tx.vsize, value: Math.round(tx.vout.reduce((acc, vout) => acc + (vout.value ? vout.value : 0), 0)), From 9f79258dec2bb34352259b932711cb224fe0fe9a Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 8 Apr 2024 13:45:05 +0000 Subject: [PATCH 2/3] Fix accelerated/effective rate labelling --- .../transaction/transaction.component.html | 2 +- .../components/transaction/transaction.component.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 9eec29c93..763e42ab4 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -613,7 +613,7 @@ @if (!isLoadingTx) { @if ((cpfpInfo && hasEffectiveFeeRate) || accelerationInfo) { - @if (tx.acceleration || accelerationInfo) { + @if (isAcceleration) { Accelerated fee rate } @else { Effective fee rate diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index dcb0fa2a0..9ea0e89e5 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -93,6 +93,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { adjustedVsize: number | null; pool: Pool | null; auditStatus: AuditStatus | null; + isAcceleration: boolean = false; filters: Filter[] = []; showCpfpDetails = false; fetchCpfp$ = new Subject(); @@ -287,6 +288,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { filter(() => this.stateService.env.ACCELERATOR === true), tap(() => { this.accelerationInfo = null; + this.setIsAccelerated(); }), switchMap((blockHeight: number) => { return this.servicesApiService.getAccelerationHistory$({ blockHeight }); @@ -302,6 +304,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { acceleration.boost = boostCost; this.accelerationInfo = acceleration; + this.setIsAccelerated(); } } }); @@ -354,6 +357,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { ).subscribe(([pool, auditStatus]) => { this.pool = pool; this.auditStatus = auditStatus; + + this.setIsAccelerated(); }); this.mempoolPositionSubscription = this.stateService.mempoolTxPosition$.subscribe(txPosition => { @@ -680,6 +685,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { } if (cpfpInfo.acceleration) { this.tx.acceleration = cpfpInfo.acceleration; + this.setIsAccelerated(); } this.cpfpInfo = cpfpInfo; @@ -691,6 +697,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.hasEffectiveFeeRate = hasRelatives || (this.tx.effectiveFeePerVsize && (Math.abs(this.tx.effectiveFeePerVsize - this.tx.feePerVsize) > 0.01)); } + setIsAccelerated() { + console.log(this.tx.acceleration, this.accelerationInfo, this.pool, this.accelerationInfo?.pools); + this.isAcceleration = (this.tx.acceleration || (this.accelerationInfo && this.pool && this.accelerationInfo.pools.some(pool => (pool === this.pool.id || pool?.['pool_unique_id'] === this.pool.id)))); + } + setFeatures(): void { if (this.tx) { this.segwitEnabled = !this.tx.status.confirmed || isFeatureActive(this.stateService.network, this.tx.status.block_height, 'segwit'); @@ -757,6 +768,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.pool = null; this.auditStatus = null; document.body.scrollTo(0, 0); + this.isAcceleration = false; this.leaveTransaction(); } From 226c6d8432ce68c4be15c587a680d1c0b3a6d10d Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 8 Apr 2024 14:08:11 +0000 Subject: [PATCH 3/3] More acceleration labelling fixes --- .../app/components/transaction/transaction.component.html | 4 ++-- .../app/components/transaction/transaction.component.ts | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 763e42ab4..55f7047e6 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -561,13 +561,13 @@ @if (!isLoadingTx) { - @if (((auditStatus && auditStatus.accelerated) || accelerationInfo || (tx && tx.acceleration)) || filters.length) { + @if (isAcceleration || filters.length) { - @if ((auditStatus && auditStatus.accelerated) || accelerationInfo || (tx && tx.acceleration)) { + @if (isAcceleration) { Accelerated } diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 9ea0e89e5..029ee487b 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -9,7 +9,8 @@ import { delay, mergeMap, tap, - map + map, + retry } from 'rxjs/operators'; import { Transaction } from '../../interfaces/electrs.interface'; import { of, merge, Subscription, Observable, Subject, from, throwError, combineLatest } from 'rxjs'; @@ -325,6 +326,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { map(block => { return block.extras.pool; }), + retry({ count: 3, delay: 2000 }), catchError(() => { return of(null); }) @@ -345,13 +347,14 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { accelerated: isAccelerated, }; }), + retry({ count: 3, delay: 2000 }), catchError(() => { return of(null); }) ) : of(isCoinbase ? { coinbase: true } : null) ]); }), - catchError(() => { + catchError((e) => { return of(null); }) ).subscribe(([pool, auditStatus]) => {