[#1167] adm/morph: Move literal to const
All checks were successful
DCO action / DCO (pull_request) Successful in 17m0s
Vulncheck / Vulncheck (pull_request) Successful in 19m52s
Build / Build Components (1.22) (pull_request) Successful in 22m7s
Build / Build Components (1.21) (pull_request) Successful in 22m14s
Tests and linters / gopls check (pull_request) Successful in 26m1s
Tests and linters / Staticcheck (pull_request) Successful in 26m45s
Tests and linters / Lint (pull_request) Successful in 27m21s
Pre-commit hooks / Pre-commit (pull_request) Successful in 28m49s
Tests and linters / Tests (1.21) (pull_request) Successful in 4m40s
Tests and linters / Tests (1.22) (pull_request) Successful in 4m50s
Tests and linters / Tests with -race (pull_request) Successful in 5m6s

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2024-06-07 16:33:03 +03:00
parent 4331bd1143
commit a9b93676e0

View file

@ -137,6 +137,8 @@ func SetConfigCmd(cmd *cobra.Command, args []string) error {
return wCtx.AwaitTx()
}
const maxECSum = 256
func validateConfig(args map[string]any, forceFlag bool) error {
var sumEC int64
_, okData := args[netmap.MaxECDataCountConfig]
@ -172,9 +174,9 @@ func validateConfig(args map[string]any, forceFlag bool) error {
}
}
if sumEC > 256 && !forceFlag {
return fmt.Errorf("the sum of %s and %s must be <= 256, got %d",
netmap.MaxECDataCountConfig, netmap.MaxECParityCountConfig, sumEC)
if sumEC > maxECSum && !forceFlag {
return fmt.Errorf("the sum of %s and %s must be <= %d, got %d",
netmap.MaxECDataCountConfig, netmap.MaxECParityCountConfig, maxECSum, sumEC)
}
return nil
}