Merge branch 'master' into nymkappa/feature/cltv
This commit is contained in:
		
						commit
						3a63375499
					
				| @ -87,29 +87,37 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges { | |||||||
|         // assume confidential inputs/outputs have the same average value as the known ones
 |         // assume confidential inputs/outputs have the same average value as the known ones
 | ||||||
|         const adjustedTotalInput = totalInput + ((totalInput / knownInputCount) * confidentialInputCount); |         const adjustedTotalInput = totalInput + ((totalInput / knownInputCount) * confidentialInputCount); | ||||||
|         const adjustedTotalOutput = totalOutput + ((totalOutput / knownOutputCount) * confidentialOutputCount); |         const adjustedTotalOutput = totalOutput + ((totalOutput / knownOutputCount) * confidentialOutputCount); | ||||||
|         return Math.max(adjustedTotalInput, adjustedTotalOutput) || 1; |         return Math.max(adjustedTotalInput, adjustedTotalOutput); | ||||||
|       } else { |       } else { | ||||||
|         // otherwise knowing the actual total of one side suffices
 |         // otherwise knowing the actual total of one side suffices
 | ||||||
|         return Math.max(totalInput, totalOutput) || 1; |         return Math.max(totalInput, totalOutput); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   initLines(side: 'in' | 'out', xputs: { type: string, value: number | void }[], total: number, maxVisibleStrands: number): SvgLine[] { |   initLines(side: 'in' | 'out', xputs: { type: string, value: number | void }[], total: number, maxVisibleStrands: number): SvgLine[] { | ||||||
|     const lines = []; |     if (!total) { | ||||||
|     let unknownCount = 0; |       const weights = xputs.map((put): number => this.combinedWeight / xputs.length); | ||||||
|     let unknownTotal = total == null ? this.combinedWeight : total; |       return this.linesFromWeights(side, xputs, weights, maxVisibleStrands); | ||||||
|     xputs.forEach(put => { |     } else { | ||||||
|       if (put.value == null) { |       let unknownCount = 0; | ||||||
|         unknownCount++; |       let unknownTotal = total; | ||||||
|       } else { |       xputs.forEach(put => { | ||||||
|         unknownTotal -= put.value as number; |         if (put.value == null) { | ||||||
|       } |           unknownCount++; | ||||||
|     }); |         } else { | ||||||
|     const unknownShare = unknownTotal / unknownCount; |           unknownTotal -= put.value as number; | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |       const unknownShare = unknownTotal / unknownCount; | ||||||
|  |       // conceptual weights
 | ||||||
|  |       const weights = xputs.map((put): number => this.combinedWeight * (put.value == null ? unknownShare : put.value as number) / total); | ||||||
|  |       return this.linesFromWeights(side, xputs, weights, maxVisibleStrands); | ||||||
|  |     } | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|     // conceptual weights
 |   linesFromWeights(side: 'in' | 'out', xputs: { type: string, value: number | void }[], weights: number[], maxVisibleStrands: number) { | ||||||
|     const weights = xputs.map((put): number => this.combinedWeight * (put.value == null ? unknownShare : put.value as number) / total); |     const lines = []; | ||||||
|     // actual displayed line thicknesses
 |     // actual displayed line thicknesses
 | ||||||
|     const minWeights = weights.map((w) => Math.max(this.minWeight - 1, w) + 1); |     const minWeights = weights.map((w) => Math.max(this.minWeight - 1, w) + 1); | ||||||
|     const visibleStrands = Math.min(maxVisibleStrands, xputs.length); |     const visibleStrands = Math.min(maxVisibleStrands, xputs.length); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user