change default derivation path to match bip45

This commit is contained in:
Craig Raw 2020-10-26 15:10:14 +02:00
parent c4f5218f29
commit 401d3b8bfb

View file

@ -430,7 +430,7 @@ public enum ScriptType {
return List.of(MULTI); return List.of(MULTI);
} }
}, },
P2SH("P2SH", "m/45'/0'/0'") { P2SH("P2SH", "m/45'") {
@Override @Override
public Address getAddress(byte[] scriptHash) { public Address getAddress(byte[] scriptHash) {
return new P2SHAddress(scriptHash); return new P2SHAddress(scriptHash);
@ -998,8 +998,11 @@ public enum ScriptType {
public List<ChildNumber> getDefaultDerivation(int account) { public List<ChildNumber> getDefaultDerivation(int account) {
List<ChildNumber> copy = new ArrayList<>(KeyDerivation.parsePath(getDefaultDerivationPath())); List<ChildNumber> copy = new ArrayList<>(KeyDerivation.parsePath(getDefaultDerivationPath()));
ChildNumber accountChildNumber = new ChildNumber(account, true); if(copy.size() > 2) {
copy.set(2, accountChildNumber); ChildNumber accountChildNumber = new ChildNumber(account, true);
copy.set(2, accountChildNumber);
}
return Collections.unmodifiableList(copy); return Collections.unmodifiableList(copy);
} }