23
23
import com .google .protobuf .ByteString ;
24
24
import java .security .SignatureException ;
25
25
import java .util .ArrayList ;
26
- import java .util .Arrays ;
27
26
import java .util .List ;
28
27
import lombok .extern .slf4j .Slf4j ;
29
28
import org .apache .commons .lang3 .ArrayUtils ;
35
34
import org .tron .api .GrpcAPI .TransactionSignWeight ;
36
35
import org .tron .api .GrpcAPI .TransactionSignWeight .Result ;
37
36
import org .tron .common .parameter .CommonParameter ;
38
- import org .tron .common .crypto .Hash ;
39
37
import org .tron .common .utils .Sha256Hash ;
40
38
import org .tron .core .ChainBaseManager ;
41
39
import org .tron .core .capsule .AccountCapsule ;
49
47
import org .tron .protos .Protocol .Transaction .Result .contractResult ;
50
48
import org .tron .protos .Protocol .TransactionSign ;
51
49
import org .tron .protos .contract .SmartContractOuterClass .CreateSmartContract ;
52
- import org .tron .protos .contract .SmartContractOuterClass .SmartContract ;
53
- import org .tron .protos .contract .SmartContractOuterClass .SmartContract .ABI ;
54
- import org .tron .protos .contract .SmartContractOuterClass .SmartContract .ABI .Entry .StateMutabilityType ;
55
50
import org .tron .protos .contract .SmartContractOuterClass .TriggerSmartContract ;
56
51
57
52
@ Slf4j (topic = "capsule" )
@@ -67,8 +62,16 @@ public class TransactionUtil {
67
62
@ Autowired
68
63
private ChainBaseManager chainBaseManager ;
69
64
65
+ public static boolean validAccountName (byte [] accountName ) {
66
+ if (ArrayUtils .isEmpty (accountName )) {
67
+ return true ; //account name can be empty
68
+ }
69
+
70
+ return accountName .length <= maxAccountNameLen ;
71
+ }
72
+
70
73
public static boolean validAccountId (byte [] accountId ) {
71
- return validReadableBytes (accountId , maxAccountIdLen ) && accountId .length < minAccountIdLen ;
74
+ return validReadableBytes (accountId , maxAccountIdLen ) && accountId .length >= minAccountIdLen ;
72
75
}
73
76
74
77
public static boolean validAssetName (byte [] assetName ) {
@@ -95,13 +98,6 @@ private static boolean validReadableBytes(byte[] bytes, int maxLength) {
95
98
return true ;
96
99
}
97
100
98
- public static boolean validAccountName (byte [] accountName ) {
99
- if (ArrayUtils .isEmpty (accountName )) {
100
- return true ; //account name can be empty
101
- }
102
- return accountName .length <= maxAccountNameLen ;
103
- }
104
-
105
101
public static boolean validAssetDescription (byte [] description ) {
106
102
if (ArrayUtils .isEmpty (description )) {
107
103
return true ; //description can empty
0 commit comments