Fix the recovery of a descriptor given a PSBT

This commit upgrades `rust-miniscript` with a fix to only return the prefix that
matches a `hd_keypath` instead of the full derivation path, and then adapts the
signer code accordingly.

This commit closes #108 and #109.
This commit is contained in:
Alekos Filini
2020-09-29 18:18:50 +02:00
parent 490c88934e
commit 1faf0ed0a0
4 changed files with 34 additions and 8 deletions

View File

@@ -358,13 +358,12 @@ impl DescriptorMeta for Descriptor<DescriptorPublicKey> {
derive_path = index
.get_key_value(&root_fingerprint)
.and_then(|(fingerprint, path)| xpub.matches(*fingerprint, path))
.map(|prefix_path| prefix_path.into_iter().cloned().collect::<Vec<_>>())
.map(|prefix| {
index
.get(&xpub.root_fingerprint())
.unwrap()
.into_iter()
.skip(prefix.len())
.skip(prefix.into_iter().count())
.cloned()
.collect()
});