Skip to content

Commit ee2e2b0

Browse files
committed
fix a bug
1 parent 3e1f933 commit ee2e2b0

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/main/java/org/tron/common/crypto/zksnark/TestVerify.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ public void verifyTx() {
119119
input[8] = new BigInteger("18066496933330839731877828156604");
120120

121121
Proof proof = new Proof(A, A_p, B, B_p, C, C_p, H, K);
122-
123-
if (new ZkVerify().verify(VerifyingKey.getInstance(), input, proof) == 0) {
122+
int result = new ZkVerify().verify(VerifyingKey.getInstance(), input, proof);
123+
if (result == 0) {
124124
System.out.println("Transaction successfully verified.");
125125
} else {
126126
System.out.println("Transaction failed verified.");
127+
System.out.printf("result = %d.\n", result);
127128
}
128129
}
129130
}

‎src/main/java/org/tron/common/crypto/zksnark/ZkVerify.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public boolean pairingProd4(G1Point a1, G2Point a2, G1Point b1, G2Point b2, G1Po
7171
}
7272

7373
public int verify(VerifyingKey vk, BigInteger[] input, Proof proof) {
74-
if (input.length + 1 == vk.getIC().length){
74+
if (input.length + 1 != vk.getIC().length){
7575
return -1;
7676
}
7777

0 commit comments

Comments
 (0)