Skip to content

Commit 0bc0da8

Browse files
committed
use slices.ContainsFunc
Signed-off-by: Angelo De Caro <[email protected]>
1 parent 7d84175 commit 0bc0da8

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Diff for: token/core/common/validator_auditing.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ SPDX-License-Identifier: Apache-2.0
77
package common
88

99
import (
10+
"slices"
11+
1012
"github.com/hyperledger-labs/fabric-token-sdk/token/driver"
1113
"github.com/pkg/errors"
1214
)
@@ -24,14 +26,7 @@ func AuditingSignaturesValidate[P driver.PublicParameters, T any, TA driver.Tran
2426
for _, auditorSignature := range ctx.TokenRequest.AuditorSignatures {
2527
auditor := auditorSignature.Identity
2628
// check that issuer of this issue action is authorized
27-
found := false
28-
for _, target := range auditors {
29-
if auditor.Equal(target) {
30-
found = true
31-
break
32-
}
33-
}
34-
if !found {
29+
if !slices.ContainsFunc(auditors, auditorSignature.Identity.Equal) {
3530
return errors.Errorf("auditor [%s] is not in auditors", auditor)
3631
}
3732

0 commit comments

Comments
 (0)