fix error with invalid chaintips
This commit is contained in:
		
							parent
							
								
									e8986e5fdc
								
							
						
					
					
						commit
						30632e9e11
					
				@ -41,7 +41,12 @@ class BitcoinApi implements AbstractBitcoinApi {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  $getBlockHeightTip(): Promise<number> {
 | 
					  $getBlockHeightTip(): Promise<number> {
 | 
				
			||||||
    return this.bitcoindClient.getChainTips()
 | 
					    return this.bitcoindClient.getChainTips()
 | 
				
			||||||
      .then((result: IBitcoinApi.ChainTips[]) => result[0].height);
 | 
					      .then((result: IBitcoinApi.ChainTips[]) => {
 | 
				
			||||||
 | 
					        const activeTip = result.find(tip => tip.status === 'active');
 | 
				
			||||||
 | 
					        if (activeTip) {
 | 
				
			||||||
 | 
					          return activeTip.height;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  $getTxIdsForBlock(hash: string): Promise<string[]> {
 | 
					  $getTxIdsForBlock(hash: string): Promise<string[]> {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user