fix issue of including parent path elements in deterministic key when deriving child xpub from an output descriptor containing more than two child path elements

This commit is contained in:
Craig Raw 2025-07-09 10:26:37 +02:00
parent 13e1fafbe8
commit e1f2ce41ad

View file

@ -449,7 +449,8 @@ public class OutputDescriptor {
keyDerivation = keyDerivation.extend(childPath);
childPath.addFirst(extendedKey.getKeyChildNumber());
DeterministicKey derivedKey = extendedKey.getKey(childPath);
extendedKey = new ExtendedKey(derivedKey, derivedKey.getParentFingerprint(), childPath.getLast());
DeterministicKey pubKey = new DeterministicKey(List.of(derivedKey.getPath().getLast()), derivedKey.getChainCode(), derivedKey.getPubKey(), derivedKey.getDepth(), derivedKey.getParentFingerprint());
extendedKey = new ExtendedKey(pubKey, pubKey.getParentFingerprint(), childPath.getLast());
}
} catch(Exception e) {
//ignore and continue