diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index eb2b90ccc..56aac6b54 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -53,18 +53,25 @@ class WebsocketHandler { if (parsedMessage['watch-mempool']) { const tx = memPool.getMempool()[client['track-tx']]; if (tx) { - if (config.MEMPOOL.BACKEND !== 'esplora') { + if (config.MEMPOOL.BACKEND === 'esplora') { + response['tx'] = tx; + } else { + // tx.prevouts is missing from transactions when in bitcoind mode try { const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true); response['tx'] = fullTx; } catch (e) { - logger.debug('Error finding transaction in mempool: ' + e.message || e); + logger.debug('Error finding transaction: ' + e.message || e); } - } else { - response['tx'] = tx; } } else { - client['track-mempool-tx'] = parsedMessage['track-tx']; + try { + const fullTx = await transactionUtils.$getTransactionExtended(client['track-tx'], true); + response['tx'] = fullTx; + } catch (e) { + logger.debug('Error finding transaction. ' + e.message || e); + client['track-mempool-tx'] = parsedMessage['track-tx']; + } } } } else { diff --git a/frontend/src/app/services/websocket.service.ts b/frontend/src/app/services/websocket.service.ts index cdcbf5cbe..dc65cf8f7 100644 --- a/frontend/src/app/services/websocket.service.ts +++ b/frontend/src/app/services/websocket.service.ts @@ -25,6 +25,7 @@ export class WebsocketService { private goneOffline = false; private lastWant: string | null = null; private isTrackingTx = false; + private trackingTxId: string; private latestGitCommit = ''; private onlineCheckTimeout: number; private onlineCheckTimeoutTwo: number; @@ -97,6 +98,9 @@ export class WebsocketService { if (this.lastWant) { this.want(JSON.parse(this.lastWant), true); } + if (this.isTrackingTx) { + this.startMultiTrackTransaction(this.trackingTxId); + } this.stateService.connectionState$.next(2); } @@ -119,11 +123,13 @@ export class WebsocketService { } this.websocketSubject.next({ 'track-tx': txId }); this.isTrackingTx = true; + this.trackingTxId = txId; } startMultiTrackTransaction(txId: string) { this.websocketSubject.next({ 'track-tx': txId, 'watch-mempool': true }); this.isTrackingTx = true; + this.trackingTxId = txId; } stopTrackingTransaction() {