Resume transaction tracking after reconnect.
This commit is contained in:
parent
4229b9b3df
commit
35c4d9676c
@ -74,7 +74,7 @@ class ProjectedBlocks {
|
|||||||
return {
|
return {
|
||||||
blockSize: blockSize,
|
blockSize: blockSize,
|
||||||
blockWeight: blockWeight,
|
blockWeight: blockWeight,
|
||||||
nTx: transactions.length - 1,
|
nTx: transactions.length,
|
||||||
minFee: transactions[transactions.length - 1].feePerVsize,
|
minFee: transactions[transactions.length - 1].feePerVsize,
|
||||||
maxFee: transactions[0].feePerVsize,
|
maxFee: transactions[0].feePerVsize,
|
||||||
minWeightFee: transactions[transactions.length - 1].feePerWeightUnit,
|
minWeightFee: transactions[transactions.length - 1].feePerWeightUnit,
|
||||||
|
@ -41,6 +41,10 @@ export class BlockchainComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.route.paramMap
|
this.route.paramMap
|
||||||
.subscribe((params: ParamMap) => {
|
.subscribe((params: ParamMap) => {
|
||||||
|
if (this.memPoolService.txTracking$.value.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const txId: string | null = params.get('id');
|
const txId: string | null = params.get('id');
|
||||||
if (!txId) {
|
if (!txId) {
|
||||||
return;
|
return;
|
||||||
@ -52,6 +56,13 @@ export class BlockchainComponent implements OnInit, OnDestroy {
|
|||||||
this.memPoolService.txIdSearch$
|
this.memPoolService.txIdSearch$
|
||||||
.subscribe((txId) => {
|
.subscribe((txId) => {
|
||||||
if (txId) {
|
if (txId) {
|
||||||
|
|
||||||
|
if (this.memPoolService.txTracking$.value.enabled
|
||||||
|
&& this.memPoolService.txTracking$.value.tx
|
||||||
|
&& this.memPoolService.txTracking$.value.tx.txid === txId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('enabling tracking loading from idSearch!');
|
||||||
this.txTrackingLoading = true;
|
this.txTrackingLoading = true;
|
||||||
this.apiService.webSocketStartTrackTx(txId);
|
this.apiService.webSocketStartTrackTx(txId);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ export class ApiService {
|
|||||||
private websocketSubject: Observable<IMempoolDefaultResponse> = webSocket<IMempoolDefaultResponse | any>(WEB_SOCKET_URL);
|
private websocketSubject: Observable<IMempoolDefaultResponse> = webSocket<IMempoolDefaultResponse | any>(WEB_SOCKET_URL);
|
||||||
private lastWant: string[] | null = null;
|
private lastWant: string[] | null = null;
|
||||||
private goneOffline = false;
|
private goneOffline = false;
|
||||||
|
private lastTrackedTxId = '';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private httpClient: HttpClient,
|
private httpClient: HttpClient,
|
||||||
@ -68,7 +69,7 @@ export class ApiService {
|
|||||||
this.memPoolService.conversions$.next(response.conversions);
|
this.memPoolService.conversions$.next(response.conversions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response['track-tx']) {
|
if (response['track-tx'] && !this.goneOffline) {
|
||||||
let txTrackingEnabled;
|
let txTrackingEnabled;
|
||||||
let txTrackingBlockHeight;
|
let txTrackingBlockHeight;
|
||||||
let txTrackingTx = null;
|
let txTrackingTx = null;
|
||||||
@ -104,6 +105,9 @@ export class ApiService {
|
|||||||
if (this.lastWant) {
|
if (this.lastWant) {
|
||||||
this.webSocketWant(this.lastWant);
|
this.webSocketWant(this.lastWant);
|
||||||
}
|
}
|
||||||
|
if (this.memPoolService.txTracking$.value.enabled) {
|
||||||
|
this.webSocketStartTrackTx(this.lastTrackedTxId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err: Error) => {
|
(err: Error) => {
|
||||||
@ -117,6 +121,7 @@ export class ApiService {
|
|||||||
webSocketStartTrackTx(txId: string) {
|
webSocketStartTrackTx(txId: string) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.websocketSubject.next({'action': 'track-tx', 'txId': txId});
|
this.websocketSubject.next({'action': 'track-tx', 'txId': txId});
|
||||||
|
this.lastTrackedTxId = txId;
|
||||||
}
|
}
|
||||||
|
|
||||||
webSocketWant(data: string[]) {
|
webSocketWant(data: string[]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user