smartcontract: implement GetDefaultHonestNodeCount
We may use this in other parts of code.
This commit is contained in:
parent
037cecf1ac
commit
44abaa8ef3
1 changed files with 7 additions and 1 deletions
|
@ -41,7 +41,7 @@ func CreateMultiSigRedeemScript(m int, publicKeys keys.PublicKeys) ([]byte, erro
|
|||
// using publicKeys length with the default BFT assumptions of (n - (n-1)/3) for m.
|
||||
func CreateDefaultMultiSigRedeemScript(publicKeys keys.PublicKeys) ([]byte, error) {
|
||||
n := len(publicKeys)
|
||||
m := n - (n-1)/3
|
||||
m := GetDefaultHonestNodeCount(n)
|
||||
return CreateMultiSigRedeemScript(m, publicKeys)
|
||||
}
|
||||
|
||||
|
@ -52,3 +52,9 @@ func CreateMajorityMultiSigRedeemScript(publicKeys keys.PublicKeys) ([]byte, err
|
|||
m := n - (n-1)/2
|
||||
return CreateMultiSigRedeemScript(m, publicKeys)
|
||||
}
|
||||
|
||||
// GetDefaultHonestNodeCount returns minimum number of honest nodes
|
||||
// required for network of size n.
|
||||
func GetDefaultHonestNodeCount(n int) int {
|
||||
return n - (n-1)/3
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue