3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 10:45:51 +00:00

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.'

This commit is contained in:
Andreas Schildbach 2015-02-20 19:02:39 +01:00
parent 1b26034506
commit dbf04a812b
2 changed files with 2 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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);
}