Skip to content

Commit

Permalink
fix the validator check (lavanet#1431)
Browse files Browse the repository at this point in the history
Co-authored-by: Yarom Swisa <[email protected] git config --global user.name Yarom>
  • Loading branch information
Yaroms and Yarom Swisa authored May 12, 2024
1 parent 69af1f2 commit e481aa6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions protocol/performance/validators/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,19 @@ func checkValidatorPerformance(ctx context.Context, clientCtx client.Context, va
if err != nil {
return retInfo, utils.LavaFormatError("failed compiling regex", err, utils.LogAttr("regex", strings.ReplaceAll(valAddr, " ", "")))
}
valAddr := ""
valAddr = ""
foundMoniker := ""
for _, validator := range allValidators.GetValidators() {
if (exact && validator.Description.Moniker == valAddr) || (!exact && (re.MatchString(validator.Description.Moniker) || re2.MatchString(validator.Description.Moniker))) {
if (exact && validator.Description.Moniker == valAddr) || (regex && (re.MatchString(validator.Description.Moniker) || re2.MatchString(validator.Description.Moniker))) {
if valAddr != "" {
return retInfo, utils.LavaFormatError("regex matched two validators", nil, utils.LogAttr("first", foundMoniker), utils.LogAttr("second", validator.Description.Moniker))
}
foundMoniker = validator.Description.Moniker
valAddr = validator.OperatorAddress
valCons, err = extractValcons(clientCtx.Codec, validator, hrp)
if err != nil {
continue
}
} else {
return retInfo, utils.LavaFormatError("regex matched two validators", nil, utils.LogAttr("first", foundMoniker), utils.LogAttr("second", validator.Description.Moniker))
}
}
if valAddr == "" {
Expand Down

0 comments on commit e481aa6

Please sign in to comment.