Fix accelerated/effective rate labelling

This commit is contained in:
Mononaut 2024-04-08 13:45:05 +00:00
parent 13bcc99095
commit 9f79258dec
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 13 additions and 1 deletions

View File

@ -613,7 +613,7 @@
@if (!isLoadingTx) {
@if ((cpfpInfo && hasEffectiveFeeRate) || accelerationInfo) {
<tr>
@if (tx.acceleration || accelerationInfo) {
@if (isAcceleration) {
<td i18n="transaction.accelerated-fee-rate|Accelerated transaction fee rate">Accelerated fee rate</td>
} @else {
<td i18n="transaction.effective-fee-rate|Effective transaction fee rate">Effective fee rate</td>

View File

@ -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<string>();
@ -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();
}