Skip to content

Commit 0b5646b

Browse files
committed
remove redundant check for v.
1 parent 3b6fe6c commit 0b5646b

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

crypto/src/main/java/org/tron/common/crypto/ECKey.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -919,13 +919,7 @@ public static ECDSASignature fromComponents(byte[] r, byte[] s, byte
919919
return signature;
920920
}
921921

922-
public static boolean validateComponents(BigInteger r, BigInteger s,
923-
byte v) {
924-
925-
if (v != 27 && v != 28) {
926-
return false;
927-
}
928-
922+
public static boolean validateComponents(BigInteger r, BigInteger s) {
929923
if (BIUtil.isLessThan(r, BigInteger.ONE)) {
930924
return false;
931925
}
@@ -941,7 +935,7 @@ public static boolean validateComponents(BigInteger r, BigInteger s,
941935

942936

943937
public boolean validateComponents() {
944-
return validateComponents(r, s, v);
938+
return validateComponents(r, s);
945939
}
946940

947941
public ECDSASignature toCanonicalised() {

crypto/src/main/java/org/tron/common/crypto/sm2/SM2.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,13 +1027,7 @@ public static SM2Signature fromComponents(byte[] r, byte[] s, byte
10271027
return signature;
10281028
}
10291029

1030-
public static boolean validateComponents(BigInteger r, BigInteger s,
1031-
byte v) {
1032-
1033-
if (v != 27 && v != 28) {
1034-
return false;
1035-
}
1036-
1030+
public static boolean validateComponents(BigInteger r, BigInteger s) {
10371031
if (isLessThan(r, BigInteger.ONE)) {
10381032
return false;
10391033
}
@@ -1083,7 +1077,7 @@ public static SM2Signature decodeFromDER(byte[] bytes) {
10831077
}
10841078

10851079
public boolean validateComponents() {
1086-
return validateComponents(r, s, v);
1080+
return validateComponents(r, s);
10871081
}
10881082

10891083

0 commit comments

Comments
 (0)