From 46c4b332065cdad01314d0430882814a88e72171 Mon Sep 17 00:00:00 2001 From: samouraidev Date: Fri, 17 Feb 2023 09:11:34 +0100 Subject: [PATCH] Modify group value test --- .../java/com/sparrowwallet/drongo/bip47/PaymentAddress.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/drongo/bip47/PaymentAddress.java b/src/main/java/com/sparrowwallet/drongo/bip47/PaymentAddress.java index fc9054d..3558787 100644 --- a/src/main/java/com/sparrowwallet/drongo/bip47/PaymentAddress.java +++ b/src/main/java/com/sparrowwallet/drongo/bip47/PaymentAddress.java @@ -71,7 +71,7 @@ public class PaymentAddress { private BigInteger addSecp256k1(BigInteger b1, BigInteger b2) { BigInteger ret = b1.add(b2); - if(ret.bitLength() > CURVE.getN().bitLength()) { + if(ret.compareTo(CURVE.getN()) > 0) { return ret.mod(CURVE.getN()); } @@ -83,7 +83,7 @@ public class PaymentAddress { } private boolean isSecp256k1(BigInteger b) { - return b.compareTo(BigInteger.ONE) > 0 && b.bitLength() <= CURVE.getN().bitLength(); + return (b.compareTo(BigInteger.ONE) > 0) && (b.compareTo(CURVE.getN()) < 0); } private BigInteger secretPoint() throws InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException, NotSecp256k1Exception {