parent
							
								
									6dffbd40f3
								
							
						
					
					
						commit
						3dca6094b7
					
				@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user