Skip to content

Commit 62cd24c

Browse files
committed
feature(updateAccountPermission): optimize UpdateAccountPermission command through interactive means
1 parent f224b44 commit 62cd24c

File tree

5 files changed

+620
-5
lines changed

5 files changed

+620
-5
lines changed

src/main/java/org/tron/common/utils/ByteUtil.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package org.tron.common.utils;
2020

21+
import static org.tron.trident.utils.Numeric.hexStringToByteArray;
22+
2123
import com.google.common.base.Preconditions;
2224
import com.google.common.primitives.UnsignedBytes;
2325
import java.math.BigInteger;
@@ -415,4 +417,29 @@ public static List<Boolean> convertBytesVectorToVector(final byte[] bytes) {
415417
return ret;
416418
}
417419

420+
public static List<Integer> hexStringToIntegerList(String hexString) {
421+
List<Integer> result = new ArrayList<>();
422+
423+
byte[] bytes = hexStringToByteArray(hexString);
424+
425+
for (int byteIndex = 0; byteIndex < bytes.length; byteIndex++) {
426+
byte currentByte = bytes[byteIndex];
427+
428+
for (int bitIndex = 0; bitIndex < 8; bitIndex++) {
429+
if ((currentByte & (1 << bitIndex)) != 0) {
430+
int value = byteIndex * 8 + bitIndex;
431+
result.add(value);
432+
}
433+
}
434+
}
435+
436+
return result;
437+
}
438+
439+
public static String integerListToHexString(List<Integer> currentOps) {
440+
byte[] operations = new byte[32];
441+
currentOps.forEach(e -> operations[e / 8] |= (1 << e % 8));
442+
return Hex.toHexString(operations);
443+
}
444+
418445
}

src/main/java/org/tron/common/utils/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public class Utils {
131131

132132
public static final int MIN_LENGTH = 2;
133133
public static final int MAX_LENGTH = 14;
134-
public static final String VERSION = " v4.9.1";
134+
public static final String VERSION = " v4.9.2";
135135
public static final String TRANSFER_METHOD_ID = "a9059cbb";
136136

137137
private static SecureRandom random = new SecureRandom();

0 commit comments

Comments
 (0)