Track and display purged transaction status

This commit is contained in:
Mononaut
2023-02-12 21:17:14 -06:00
parent 5826f8fa1e
commit 2e6a0c0967
7 changed files with 56 additions and 0 deletions

View File

@@ -1,6 +1,10 @@
<div class="container-xl">
<div class="title-block">
<div *ngIf="isPurged" class="alert alert-mempool" role="alert">
<span i18n="transaction.purged|Purged from mempool">This transaction has been purged from our default sized 300MB mempool</span>
</div>
<div *ngIf="rbfTransaction" class="alert alert-mempool" role="alert">
<span i18n="transaction.rbf.replacement|RBF replacement">This transaction has been replaced by:</span>
<app-truncate [text]="rbfTransaction.txid" [lastChars]="12" [link]="['/tx/' | relativeUrl, rbfTransaction.txid]"></app-truncate>

View File

@@ -46,6 +46,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
fetchRbfSubscription: Subscription;
fetchCachedTxSubscription: Subscription;
txReplacedSubscription: Subscription;
txPurgedSubscription: Subscription;
blocksSubscription: Subscription;
queryParamsSubscription: Subscription;
urlFragmentSubscription: Subscription;
@@ -59,6 +60,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
fetchRbfHistory$ = new Subject<string>();
fetchCachedTx$ = new Subject<string>();
isCached: boolean = false;
isPurged: boolean = false;
now = new Date().getTime();
timeAvg$: Observable<number>;
liquidUnblinding = new LiquidUnblinding();
@@ -380,6 +382,10 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
}
});
this.txPurgedSubscription = this.stateService.txPurged$.subscribe((isPurged) => {
this.isPurged = isPurged;
});
this.queryParamsSubscription = this.route.queryParams.subscribe((params) => {
if (params.showFlow === 'false') {
this.overrideFlowPreference = false;
@@ -532,6 +538,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.fetchRbfSubscription.unsubscribe();
this.fetchCachedTxSubscription.unsubscribe();
this.txReplacedSubscription.unsubscribe();
this.txPurgedSubscription.unsubscribe();
this.blocksSubscription.unsubscribe();
this.queryParamsSubscription.unsubscribe();
this.flowPrefSubscription.unsubscribe();

View File

@@ -16,6 +16,7 @@ export interface WebsocketResponse {
tx?: Transaction;
rbfTransaction?: ReplacedTransaction;
txReplaced?: ReplacedTransaction;
txPurged?: boolean;
utxoSpent?: object;
transactions?: TransactionStripped[];
loadingIndicators?: ILoadingIndicators;

View File

@@ -98,6 +98,7 @@ export class StateService {
mempoolBlockTransactions$ = new Subject<TransactionStripped[]>();
mempoolBlockDelta$ = new Subject<MempoolBlockDelta>();
txReplaced$ = new Subject<ReplacedTransaction>();
txPurged$ = new Subject<boolean>();
utxoSpent$ = new Subject<object>();
difficultyAdjustment$ = new ReplaySubject<DifficultyAdjustment>(1);
mempoolTransactions$ = new Subject<Transaction>();

View File

@@ -261,6 +261,10 @@ export class WebsocketService {
this.stateService.txReplaced$.next(response.txReplaced);
}
if (response.txPurged != null) {
this.stateService.txPurged$.next(response.txPurged);
}
if (response['mempool-blocks']) {
this.stateService.mempoolBlocks$.next(response['mempool-blocks']);
}