|
62 | 62 | import org.tron.core.exception.ZksnarkException; |
63 | 63 | import org.tron.core.vm.config.VMConfig; |
64 | 64 | import org.tron.core.vm.program.Program; |
| 65 | +import org.tron.core.vm.program.Program.OutOfTimeException; |
65 | 66 | import org.tron.core.vm.repository.Repository; |
66 | 67 | import org.tron.core.vm.utils.FreezeV2Util; |
| 68 | +import org.tron.core.vm.utils.MUtil; |
67 | 69 | import org.tron.core.vm.utils.VoteRewardUtil; |
68 | 70 | import org.tron.protos.Protocol; |
69 | 71 | import org.tron.protos.Protocol.Permission; |
@@ -944,24 +946,33 @@ public Pair<Boolean, byte[]> execute(byte[] rawData) { |
944 | 946 | long totalWeight = 0L; |
945 | 947 | List<byte[]> executedSignList = new ArrayList<>(); |
946 | 948 | for (byte[] sign : signatures) { |
947 | | - if (ByteArray.matrixContains(executedSignList, sign)) { |
948 | | - continue; |
949 | | - } |
950 | 949 | byte[] recoveredAddr = recoverAddrBySign(sign, hash); |
| 950 | + |
| 951 | + sign = merge(recoveredAddr, sign); |
| 952 | + if (ByteArray.matrixContains(executedSignList, recoveredAddr)) { |
| 953 | + if (ByteArray.matrixContains(executedSignList, sign)) { |
| 954 | + continue; |
| 955 | + } |
| 956 | + MUtil.checkCPUTime(); |
| 957 | + } |
951 | 958 | long weight = TransactionCapsule.getWeight(permission, recoveredAddr); |
952 | 959 | if (weight == 0) { |
953 | 960 | //incorrect sign |
954 | 961 | return Pair.of(true, DATA_FALSE); |
955 | 962 | } |
956 | 963 | totalWeight += weight; |
957 | 964 | executedSignList.add(sign); |
| 965 | + executedSignList.add(recoveredAddr); |
958 | 966 | } |
959 | 967 |
|
960 | 968 | if (totalWeight >= permission.getThreshold()) { |
961 | 969 | return Pair.of(true, dataOne()); |
962 | 970 | } |
963 | 971 | } |
964 | 972 | } catch (Throwable t) { |
| 973 | + if (t instanceof OutOfTimeException) { |
| 974 | + throw t; |
| 975 | + } |
965 | 976 | logger.info("ValidateMultiSign error:{}", t.getMessage()); |
966 | 977 | } |
967 | 978 | } |
|
0 commit comments