Fix RSConfig calculation in testplanet.Uplink.GetConfig (#1770)
This commit is contained in:
parent
5b3c146d8a
commit
860c5d86d7
@ -298,10 +298,10 @@ func (uplink *Uplink) GetConfig(satellite *satellite.Peer) uplink.Config {
|
||||
config.Client.SatelliteAddr = satellite.Addr()
|
||||
config.Client.APIKey = uplink.APIKey[satellite.ID()]
|
||||
|
||||
config.RS.MinThreshold = 1 * uplink.StorageNodeCount / 5
|
||||
config.RS.RepairThreshold = 2 * uplink.StorageNodeCount / 5
|
||||
config.RS.SuccessThreshold = 3 * uplink.StorageNodeCount / 5
|
||||
config.RS.MaxThreshold = 4 * uplink.StorageNodeCount / 5
|
||||
config.RS.MinThreshold = atLeastOne(uplink.StorageNodeCount * 1 / 5) // 20% of storage nodes
|
||||
config.RS.RepairThreshold = atLeastOne(uplink.StorageNodeCount * 2 / 5) // 40% of storage nodes
|
||||
config.RS.SuccessThreshold = atLeastOne(uplink.StorageNodeCount * 3 / 5) // 60% of storage nodes
|
||||
config.RS.MaxThreshold = atLeastOne(uplink.StorageNodeCount * 4 / 5) // 80% of storage nodes
|
||||
|
||||
config.TLS.UsePeerCAWhitelist = false
|
||||
config.TLS.Extensions.Revocation = false
|
||||
@ -315,3 +315,11 @@ func getDefaultConfig() uplink.Config {
|
||||
cfgstruct.Bind(&pflag.FlagSet{}, &config, true)
|
||||
return config
|
||||
}
|
||||
|
||||
// atLeastOne returns 1 if value < 1, or value otherwise.
|
||||
func atLeastOne(value int) int {
|
||||
if value < 1 {
|
||||
return 1
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user