/** Constructs a key from its components. This is not normally something you should use. */ public DeterministicKey( ImmutableList<ChildNumber> childNumberPath, byte[] chainCode, BigInteger priv, @Nullable DeterministicKey parent) { super(priv, compressPoint(ECKey.publicPointFromPrivate(priv))); checkArgument(chainCode.length == 32); this.parent = parent; this.childNumberPath = checkNotNull(childNumberPath); this.chainCode = Arrays.copyOf(chainCode, chainCode.length); this.depth = this.childNumberPath.size(); this.parentFingerprint = (parent != null) ? parent.getFingerprint() : 0; }
/** * Constructs a key from its components, including its private key data and possibly-redundant * information about its parent key. Invoked when deserializing, but otherwise not something that * you normally should use. */ private DeterministicKey( ImmutableList<ChildNumber> childNumberPath, byte[] chainCode, BigInteger priv, @Nullable DeterministicKey parent, int depth, int parentFingerprint) { super(priv, compressPoint(ECKey.publicPointFromPrivate(priv))); checkArgument(chainCode.length == 32); this.parent = parent; this.childNumberPath = checkNotNull(childNumberPath); this.chainCode = Arrays.copyOf(chainCode, chainCode.length); this.depth = depth; this.parentFingerprint = ascertainParentFingerprint(parent, parentFingerprint); }