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:
parent
1b26034506
commit
dbf04a812b
@ -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
|
// We expect the pubkey to be in regular encoded form, just as a BigInteger. Therefore the first byte is
|
||||||
// a special marker byte.
|
// a special marker byte.
|
||||||
// TODO: This is probably not a useful API and may be confusing.
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,8 +495,7 @@ public class DeterministicKey extends ECKey {
|
|||||||
buffer.get(data);
|
buffer.get(data);
|
||||||
checkArgument(!buffer.hasRemaining(), "Found unexpected data in key");
|
checkArgument(!buffer.hasRemaining(), "Found unexpected data in key");
|
||||||
if (pub) {
|
if (pub) {
|
||||||
ECPoint point = ECKey.CURVE.getCurve().decodePoint(data);
|
return new DeterministicKey(path, chainCode, new LazyECPoint(ECKey.CURVE.getCurve(), data), parent, depth, parentFingerprint);
|
||||||
return new DeterministicKey(path, chainCode, new LazyECPoint(point), parent, depth, parentFingerprint);
|
|
||||||
} else {
|
} else {
|
||||||
return new DeterministicKey(path, chainCode, new BigInteger(1, data), parent, depth, parentFingerprint);
|
return new DeterministicKey(path, chainCode, new BigInteger(1, data), parent, depth, parentFingerprint);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user