Send correct tx conf status in websocket msgs
This commit is contained in:
		
							parent
							
								
									83c285e17d
								
							
						
					
					
						commit
						441b505aa3
					
				@ -81,6 +81,7 @@ class Blocks {
 | 
				
			|||||||
  private async $getTransactionsExtended(
 | 
					  private async $getTransactionsExtended(
 | 
				
			||||||
    blockHash: string,
 | 
					    blockHash: string,
 | 
				
			||||||
    blockHeight: number,
 | 
					    blockHeight: number,
 | 
				
			||||||
 | 
					    blockTime: number,
 | 
				
			||||||
    onlyCoinbase: boolean,
 | 
					    onlyCoinbase: boolean,
 | 
				
			||||||
    txIds: string[] | null = null,
 | 
					    txIds: string[] | null = null,
 | 
				
			||||||
    quiet: boolean = false,
 | 
					    quiet: boolean = false,
 | 
				
			||||||
@ -101,6 +102,12 @@ class Blocks {
 | 
				
			|||||||
    if (!onlyCoinbase) {
 | 
					    if (!onlyCoinbase) {
 | 
				
			||||||
      for (const txid of txIds) {
 | 
					      for (const txid of txIds) {
 | 
				
			||||||
        if (mempool[txid]) {
 | 
					        if (mempool[txid]) {
 | 
				
			||||||
 | 
					          mempool[txid].status = {
 | 
				
			||||||
 | 
					            confirmed: true,
 | 
				
			||||||
 | 
					            block_height: blockHeight,
 | 
				
			||||||
 | 
					            block_hash: blockHash,
 | 
				
			||||||
 | 
					            block_time: blockTime,
 | 
				
			||||||
 | 
					          };
 | 
				
			||||||
          transactionMap[txid] = mempool[txid];
 | 
					          transactionMap[txid] = mempool[txid];
 | 
				
			||||||
          foundInMempool++;
 | 
					          foundInMempool++;
 | 
				
			||||||
          totalFound++;
 | 
					          totalFound++;
 | 
				
			||||||
@ -608,7 +615,7 @@ class Blocks {
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
          const blockHash = await bitcoinApi.$getBlockHash(blockHeight);
 | 
					          const blockHash = await bitcoinApi.$getBlockHash(blockHeight);
 | 
				
			||||||
          const block: IEsploraApi.Block = await bitcoinApi.$getBlock(blockHash);
 | 
					          const block: IEsploraApi.Block = await bitcoinApi.$getBlock(blockHash);
 | 
				
			||||||
          const transactions = await this.$getTransactionsExtended(blockHash, block.height, true, null, true);
 | 
					          const transactions = await this.$getTransactionsExtended(blockHash, block.height, block.timestamp, true, null, true);
 | 
				
			||||||
          const blockExtended = await this.$getBlockExtended(block, transactions);
 | 
					          const blockExtended = await this.$getBlockExtended(block, transactions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          newlyIndexed++;
 | 
					          newlyIndexed++;
 | 
				
			||||||
@ -701,7 +708,7 @@ class Blocks {
 | 
				
			|||||||
      const verboseBlock = await bitcoinClient.getBlock(blockHash, 2);
 | 
					      const verboseBlock = await bitcoinClient.getBlock(blockHash, 2);
 | 
				
			||||||
      const block = BitcoinApi.convertBlock(verboseBlock);
 | 
					      const block = BitcoinApi.convertBlock(verboseBlock);
 | 
				
			||||||
      const txIds: string[] = verboseBlock.tx.map(tx => tx.txid);
 | 
					      const txIds: string[] = verboseBlock.tx.map(tx => tx.txid);
 | 
				
			||||||
      const transactions = await this.$getTransactionsExtended(blockHash, block.height, false, txIds, false, true) as MempoolTransactionExtended[];
 | 
					      const transactions = await this.$getTransactionsExtended(blockHash, block.height, block.timestamp, false, txIds, false, true) as MempoolTransactionExtended[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // fill in missing transaction fee data from verboseBlock
 | 
					      // fill in missing transaction fee data from verboseBlock
 | 
				
			||||||
      for (let i = 0; i < transactions.length; i++) {
 | 
					      for (let i = 0; i < transactions.length; i++) {
 | 
				
			||||||
@ -890,7 +897,7 @@ class Blocks {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const blockHash = await bitcoinApi.$getBlockHash(height);
 | 
					    const blockHash = await bitcoinApi.$getBlockHash(height);
 | 
				
			||||||
    const block: IEsploraApi.Block = await bitcoinApi.$getBlock(blockHash);
 | 
					    const block: IEsploraApi.Block = await bitcoinApi.$getBlock(blockHash);
 | 
				
			||||||
    const transactions = await this.$getTransactionsExtended(blockHash, block.height, true);
 | 
					    const transactions = await this.$getTransactionsExtended(blockHash, block.height, block.timestamp, true);
 | 
				
			||||||
    const blockExtended = await this.$getBlockExtended(block, transactions);
 | 
					    const blockExtended = await this.$getBlockExtended(block, transactions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (Common.indexingEnabled()) {
 | 
					    if (Common.indexingEnabled()) {
 | 
				
			||||||
@ -902,7 +909,7 @@ class Blocks {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  public async $indexStaleBlock(hash: string): Promise<BlockExtended> {
 | 
					  public async $indexStaleBlock(hash: string): Promise<BlockExtended> {
 | 
				
			||||||
    const block: IEsploraApi.Block = await bitcoinApi.$getBlock(hash);
 | 
					    const block: IEsploraApi.Block = await bitcoinApi.$getBlock(hash);
 | 
				
			||||||
    const transactions = await this.$getTransactionsExtended(hash, block.height, true);
 | 
					    const transactions = await this.$getTransactionsExtended(hash, block.height, block.timestamp, true);
 | 
				
			||||||
    const blockExtended = await this.$getBlockExtended(block, transactions);
 | 
					    const blockExtended = await this.$getBlockExtended(block, transactions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    blockExtended.canonical = await bitcoinApi.$getBlockHash(block.height);
 | 
					    blockExtended.canonical = await bitcoinApi.$getBlockHash(block.height);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user