track p2pk addresses by scriptpubkey not scripthash
This commit is contained in:
		
							parent
							
								
									74b87b6006
								
							
						
					
					
						commit
						5b2470955d
					
				@ -191,14 +191,14 @@ class WebsocketHandler {
 | 
				
			|||||||
              }
 | 
					              }
 | 
				
			||||||
              if (/^[0-9a-fA-F]{130}$/.test(parsedMessage['track-address'])) {
 | 
					              if (/^[0-9a-fA-F]{130}$/.test(parsedMessage['track-address'])) {
 | 
				
			||||||
                client['track-address'] = null;
 | 
					                client['track-address'] = null;
 | 
				
			||||||
                client['track-scripthash'] = transactionUtils.calcScriptHash('41' + matchedAddress + 'ac');
 | 
					                client['track-scriptpubkey'] = '41' + matchedAddress + 'ac';
 | 
				
			||||||
              } else {
 | 
					              } else {
 | 
				
			||||||
                client['track-address'] = matchedAddress;
 | 
					                client['track-address'] = matchedAddress;
 | 
				
			||||||
                client['track-scripthash'] = null;
 | 
					                client['track-scriptpubkey'] = null;
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
              client['track-address'] = null;
 | 
					              client['track-address'] = null;
 | 
				
			||||||
              client['track-scripthash'] = null;
 | 
					              client['track-scriptpubkey'] = null;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -553,11 +553,11 @@ class WebsocketHandler {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (client['track-scripthash']) {
 | 
					      if (client['track-scriptpubkey']) {
 | 
				
			||||||
        const foundTransactions: TransactionExtended[] = [];
 | 
					        const foundTransactions: TransactionExtended[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (const tx of newTransactions) {
 | 
					        for (const tx of newTransactions) {
 | 
				
			||||||
          const someVin = tx.vin.some((vin) => !!vin.prevout && vin.prevout.scriptpubkey_type === 'p2pk' && vin.prevout.scriptpubkey === client['track-scripthash']);
 | 
					          const someVin = tx.vin.some((vin) => !!vin.prevout && vin.prevout.scriptpubkey_type === 'p2pk' && vin.prevout.scriptpubkey === client['track-scriptpubkey']);
 | 
				
			||||||
          if (someVin) {
 | 
					          if (someVin) {
 | 
				
			||||||
            if (config.MEMPOOL.BACKEND !== 'esplora') {
 | 
					            if (config.MEMPOOL.BACKEND !== 'esplora') {
 | 
				
			||||||
              try {
 | 
					              try {
 | 
				
			||||||
@ -571,7 +571,7 @@ class WebsocketHandler {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          const someVout = tx.vout.some((vout) => vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey === client['track-scripthash']);
 | 
					          const someVout = tx.vout.some((vout) => vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey === client['track-scriptpubkey']);
 | 
				
			||||||
          if (someVout) {
 | 
					          if (someVout) {
 | 
				
			||||||
            if (config.MEMPOOL.BACKEND !== 'esplora') {
 | 
					            if (config.MEMPOOL.BACKEND !== 'esplora') {
 | 
				
			||||||
              try {
 | 
					              try {
 | 
				
			||||||
@ -866,15 +866,15 @@ class WebsocketHandler {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (client['track-scripthash']) {
 | 
					      if (client['track-scriptpubkey']) {
 | 
				
			||||||
        const foundTransactions: TransactionExtended[] = [];
 | 
					        const foundTransactions: TransactionExtended[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        transactions.forEach((tx) => {
 | 
					        transactions.forEach((tx) => {
 | 
				
			||||||
          if (tx.vin && tx.vin.some((vin) => !!vin.prevout && vin.prevout.scriptpubkey_type === 'p2pk' && vin.prevout.scriptpubkey === client['track-scripthash'])) {
 | 
					          if (tx.vin && tx.vin.some((vin) => !!vin.prevout && vin.prevout.scriptpubkey_type === 'p2pk' && vin.prevout.scriptpubkey === client['track-scriptpubkey'])) {
 | 
				
			||||||
            foundTransactions.push(tx);
 | 
					            foundTransactions.push(tx);
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          if (tx.vout && tx.vout.some((vout) => vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey === client['track-scripthash'])) {
 | 
					          if (tx.vout && tx.vout.some((vout) => vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey === client['track-scriptpubkey'])) {
 | 
				
			||||||
            foundTransactions.push(tx);
 | 
					            foundTransactions.push(tx);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user