The new bip32_key_from_parent_path_str function takes a path_str argument. When this starts with m/ it should strip the first depth levels from the path string. Currently it just treats everything as a relative path.
This would help me avoid a string manipulation workaround like this:
// Convert absolute path to relative:
var tmpPath = path
if path.split(separator: "/").first == "m" {
tmpPath = path.split(separator: "/").dropFirst(1 + Int(self.wally_ext_key.depth)).joined(separator: "/")
}
It's especially useful in de context of PSBT processing, where the PSBT will have absolute paths, but the wallet may want to derive from a (cached) xpub to see if it can sign something, as well as for change detection.
Perhaps a flag could be added to (dis)allow the use of absolute paths when deriving from depth > 0 since that can lead to mistakes.
The new
bip32_key_from_parent_path_strfunction takes apath_strargument. When this starts withm/it should strip the firstdepthlevels from the path string. Currently it just treats everything as a relative path.This would help me avoid a string manipulation workaround like this:
It's especially useful in de context of PSBT processing, where the PSBT will have absolute paths, but the wallet may want to derive from a (cached) xpub to see if it can sign something, as well as for change detection.
Perhaps a flag could be added to (dis)allow the use of absolute paths when deriving from
depth > 0since that can lead to mistakes.