/** * Creates a deterministic key chain that watches the given (public only) root key. You can use * this to calculate balances and generally follow along, but spending is not possible with such a * chain. Currently you can't use this method to watch an arbitrary fragment of some other tree, * this limitation may be removed in future. */ public DeterministicKeyChain(DeterministicKey watchingKey, long creationTimeSeconds) { checkArgument(watchingKey.isPubKeyOnly(), "Private subtrees not currently supported"); checkArgument(watchingKey.getPath().size() == 1, "You can only watch an account key currently"); basicKeyChain = new BasicKeyChain(); this.creationTimeSeconds = creationTimeSeconds; this.seed = null; initializeHierarchyUnencrypted(watchingKey); }
/** * A deterministic key is considered to be 'public key only' if it hasn't got a private key part * and it cannot be rederived. If the hierarchy is encrypted this returns true. */ @Override public boolean isPubKeyOnly() { return super.isPubKeyOnly() && (parent == null || parent.isPubKeyOnly()); }