github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/signature/threshold.go (about)

     1  package signature
     2  
     3  // RandomBeaconThreshold returns the threshold (t) to allow the largest number of
     4  // malicious nodes (m) assuming the protocol requires:
     5  //   - m<=t for unforgeability
     6  //   - n-m>=t+1 for robustness
     7  func RandomBeaconThreshold(size int) int {
     8  	// avoid initializing the threshold to 0 when n=2
     9  	if size == 2 {
    10  		return 1
    11  	}
    12  	return (size - 1) / 2
    13  }