From cbe57555b241e0c4e408eed4f83e1d8a0cc16425 Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Mon, 15 Aug 2016 23:00:41 +1200 Subject: [PATCH] Expose the DeterministicKey ctors used by serialisation These ctors are the only way to construct a key without a parent but with a depth that matches the path passed in. The ctors taking parents set the depth to 0 when parent is null. Whether this is desirable is not clear; exposing the other ctors seems a lower risk change given the comments in this file that detail support for depth not matching the path length. The use case for this change is interfacing with APIs that allow derivation of children from a path without returning the intermediate keys. In this case we have no parent to pass to the ctor but we want to create a correct DeterministicKey for interop with the rest of bitcoinj. --- core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java b/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java index b91438cda..a4b2c858a 100644 --- a/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java +++ b/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java @@ -130,7 +130,7 @@ public class DeterministicKey extends ECKey { * information about its parent key. Invoked when deserializing, but otherwise not something that * you normally should use. */ - private DeterministicKey(ImmutableList childNumberPath, + public DeterministicKey(ImmutableList childNumberPath, byte[] chainCode, LazyECPoint publicAsPoint, @Nullable DeterministicKey parent, @@ -150,7 +150,7 @@ public class DeterministicKey extends ECKey { * information about its parent key. Invoked when deserializing, but otherwise not something that * you normally should use. */ - private DeterministicKey(ImmutableList childNumberPath, + public DeterministicKey(ImmutableList childNumberPath, byte[] chainCode, BigInteger priv, @Nullable DeterministicKey parent,