Skip to content

Commit 225e799

Browse files
committed
refactor: use slices.Contains to simplify code
Signed-off-by: geekvest <cuimoman@sohu.com>
1 parent f380c94 commit 225e799

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

sdk/batch_transaction.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package hiero
22

33
import (
44
"reflect"
5+
"slices"
56

67
"github.com/hiero-ledger/hiero-sdk-go/v2/proto/services"
78
"github.com/pkg/errors"
@@ -94,10 +95,8 @@ func (tx *BatchTransaction) validateInnerTransaction(innerTransaction Transactio
9495

9596
// Validate transaction type is not blacklisted
9697
txType := reflect.TypeOf(innerTransaction)
97-
for _, blacklistedType := range blacklistedTransactions {
98-
if txType == blacklistedType {
99-
return errTransactionTypeNotAllowed
100-
}
98+
if slices.Contains(blacklistedTransactions, txType) {
99+
return errTransactionTypeNotAllowed
101100
}
102101

103102
innerBaseTransaction := innerTransaction.getBaseTransaction()

0 commit comments

Comments
 (0)