From dbf04a812bce82e1c800f27d30fb5cf9f4f514a7 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Fri, 20 Feb 2015 19:02:39 +0100 Subject: [PATCH] Devrandom's proposed changes due to his review of 'ECKey/DeterministicKey: replace ECPoint with a LazyECPoint wrapper that doesn't delays parsing of key bytes into a key structure until it's needed.' --- core/src/main/java/org/bitcoinj/core/ECKey.java | 2 +- core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/core/ECKey.java b/core/src/main/java/org/bitcoinj/core/ECKey.java index e9b1cbef..2c9d178b 100644 --- a/core/src/main/java/org/bitcoinj/core/ECKey.java +++ b/core/src/main/java/org/bitcoinj/core/ECKey.java @@ -369,7 +369,7 @@ public class ECKey implements EncryptableItem, Serializable { // We expect the pubkey to be in regular encoded form, just as a BigInteger. Therefore the first byte is // a special marker byte. // TODO: This is probably not a useful API and may be confusing. - this.pub = new LazyECPoint(CURVE.getCurve().decodePoint(pubKey)); + this.pub = new LazyECPoint(CURVE.getCurve(), pubKey); } } diff --git a/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java b/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java index 3dd7fa89..c26eba7a 100644 --- a/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java +++ b/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java @@ -495,8 +495,7 @@ public class DeterministicKey extends ECKey { buffer.get(data); checkArgument(!buffer.hasRemaining(), "Found unexpected data in key"); if (pub) { - ECPoint point = ECKey.CURVE.getCurve().decodePoint(data); - return new DeterministicKey(path, chainCode, new LazyECPoint(point), parent, depth, parentFingerprint); + return new DeterministicKey(path, chainCode, new LazyECPoint(ECKey.CURVE.getCurve(), data), parent, depth, parentFingerprint); } else { return new DeterministicKey(path, chainCode, new BigInteger(1, data), parent, depth, parentFingerprint); }