Fix health score when mempool was empty
This commit is contained in:
		
							parent
							
								
									505532f812
								
							
						
					
					
						commit
						8dc80eadf3
					
				| @ -144,7 +144,12 @@ class Audit { | ||||
| 
 | ||||
|     const numCensored = Object.keys(isCensored).length; | ||||
|     const numMatches = matches.length - 1; // adjust for coinbase tx
 | ||||
|     const score = numMatches > 0 ? (numMatches / (numMatches + numCensored)) : 0; | ||||
|     let score = 0; | ||||
|     if (numMatches <= 0 && numCensored <= 0) { | ||||
|       score = 1; | ||||
|     } else if (numMatches > 0) { | ||||
|       score = (numMatches / (numMatches + numCensored)); | ||||
|     } | ||||
|     const similarity = projectedWeight ? matchedWeight / projectedWeight : 1; | ||||
| 
 | ||||
|     return { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user