Track and display purged transaction status

This commit is contained in:
Mononaut
2023-02-12 21:17:14 -06:00
parent cf0897e27c
commit ac5006e5df
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

@@ -43,6 +43,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
fetchRbfSubscription: Subscription;
fetchCachedTxSubscription: Subscription;
txReplacedSubscription: Subscription;
txPurgedSubscription: Subscription;
blocksSubscription: Subscription;
queryParamsSubscription: Subscription;
urlFragmentSubscription: Subscription;
@@ -55,6 +56,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
fetchCpfp$ = new Subject<string>();
fetchRbfHistory$ = new Subject<string>();
fetchCachedTx$ = new Subject<string>();
isPurged: boolean = false;
now = new Date().getTime();
timeAvg$: Observable<number>;
liquidUnblinding = new LiquidUnblinding();
@@ -359,6 +361,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;
@@ -494,6 +500,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

@@ -94,6 +94,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']);
}