// Derives the account path keys and inserts them into the basic key chain. This is important to // preserve their // order for serialization, amongst other things. private void initializeHierarchyUnencrypted(DeterministicKey baseKey) { if (baseKey.getPath().isEmpty()) { // baseKey is a master/root key derived directly from a seed. addToBasicChain(rootKey); hierarchy = new DeterministicHierarchy(rootKey); addToBasicChain(hierarchy.get(ACCOUNT_ZERO_PATH, false, true)); } else if (baseKey.getPath().size() == 1) { // baseKey is a "watching key" that we were given so we could follow along with this account. rootKey = null; addToBasicChain(baseKey); hierarchy = new DeterministicHierarchy(baseKey); } else { throw new IllegalArgumentException(); } externalKey = hierarchy.deriveChild(ACCOUNT_ZERO_PATH, false, false, ChildNumber.ZERO); internalKey = hierarchy.deriveChild(ACCOUNT_ZERO_PATH, false, false, ChildNumber.ONE); addToBasicChain(externalKey); addToBasicChain(internalKey); }