Skip to content

Commit

Permalink
Merge pull request #4 from ProtocolCash/cash-derivationpath
Browse files Browse the repository at this point in the history
Update Default Key Derivation Path
  • Loading branch information
ProtocolCash authored Apr 18, 2019
2 parents c223a3a + e445386 commit 8ba7972
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey
@Override
public DeterministicKeyChain makeWatchingKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicKey accountKey,
boolean isFollowingKey, boolean isMarried) throws UnreadableWalletException {
if (!accountKey.getPath().equals(DeterministicKeyChain.ACCOUNT_ZERO_PATH))
if (!accountKey.getPath().equals(DeterministicKeyChain.BIP44_ACCOUNT_145_PATH))
throw new UnreadableWalletException("Expecting account key but found key with path: " +
HDUtils.formatPath(accountKey.getPath()));
DeterministicKeyChain chain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,9 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
public static final ImmutableList<ChildNumber> ACCOUNT_ZERO_PATH = ImmutableList.of(ChildNumber.ZERO_HARDENED);
public static final ImmutableList<ChildNumber> EXTERNAL_SUBPATH = ImmutableList.of(ChildNumber.ZERO);
public static final ImmutableList<ChildNumber> INTERNAL_SUBPATH = ImmutableList.of(ChildNumber.ONE);
public static final ImmutableList<ChildNumber> EXTERNAL_PATH = HDUtils.concat(ACCOUNT_ZERO_PATH, EXTERNAL_SUBPATH);
public static final ImmutableList<ChildNumber> INTERNAL_PATH = HDUtils.concat(ACCOUNT_ZERO_PATH, INTERNAL_SUBPATH);
// m / 44' / 0' / 0'
public static final ImmutableList<ChildNumber> BIP44_ACCOUNT_ZERO_PATH =
ImmutableList.of(new ChildNumber(44, true), ChildNumber.ZERO_HARDENED, ChildNumber.ZERO_HARDENED);
// m / 44' / 145' / 0'
public static final ImmutableList<ChildNumber> BIP44_ACCOUNT_145_PATH =
ImmutableList.of(new ChildNumber(44, true), new ChildNumber(145, true), ChildNumber.ZERO_HARDENED);

// We try to ensure we have at least this many keys ready and waiting to be handed out via getKey().
// See docs for getLookaheadSize() for more info on what this is for. The -1 value means it hasn't been calculated
Expand Down Expand Up @@ -420,7 +418,7 @@ protected DeterministicKeyChain(KeyCrypter crypter, KeyParameter aesKey, Determi

/** Override in subclasses to use a different account derivation path */
protected ImmutableList<ChildNumber> getAccountPath() {
return ACCOUNT_ZERO_PATH;
return BIP44_ACCOUNT_145_PATH;
}

private DeterministicKey encryptNonLeaf(KeyParameter aesKey, DeterministicKeyChain chain,
Expand Down

0 comments on commit 8ba7972

Please sign in to comment.