github.com/insolar/vanilla@v0.0.0-20201023172447-248fdf805322/consensuskit/tools.go (about)

     1  // Copyright 2020 Insolar Network Ltd.
     2  // All rights reserved.
     3  // This material is licensed under the Insolar License version 1.0,
     4  // available at https://github.com/insolar/assured-ledger/blob/master/LICENSE.md.
     5  
     6  package consensuskit
     7  
     8  // BftMajority function guarantees that (float(bftMajorityCount)/nodeCount > 2.0/3.0)
     9  //  AND	(float(bftMajorityCount - 1)/nodeCount <= 2.0/3.0)
    10  func BftMajority(nodeCount int) int {
    11  	return nodeCount - BftMinority(nodeCount)
    12  }
    13  
    14  func BftMinority(nodeCount int) int {
    15  	return (nodeCount - 1) / 3
    16  }