You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #241: fix(wallet): fix into_descriptor_key for DescriptorPublicKey
469cfd0 fix(wallet): fix `into_descriptor_key` for DescriptorPublicKey (valued mammal)
Pull request description:
Fix `into_descriptor_key` for `DescriptorPublicKey` by including the missing match arm for `DescriptorPublicKey::MultiXPub` when initializing `networks`.
Test that `into_wallet_descriptor` correctly parses a multipath descriptor and fails if passed a network that is invalid for the descriptor.
Note that rust-miniscript doesn't support parsing a multipath descriptor containing extended private keys.
fixes#10
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo +nightly fmt` and `cargo clippy` before committing
#### New Features:
* [ ] I've added tests for the new feature
* [ ] I've added docs for the new feature
#### Bugfixes:
* [ ] This pull request breaks the existing API
* [x] I've added tests to reproduce the issue which are now passing
* [x] I'm linking the issue being fixed by this PR
ACKs for top commit:
notmandatory:
ACK 469cfd0
oleonardolima:
ACK 469cfd0
Tree-SHA512: e5b26b5e52308500e57a322fbe94b294adef605afc9aab93b649cdc2c930e7c043170b531fd5fb0da560f384d4574ac3bc86adb4d6a6d52b10db7694b3667fe4
// See <https://github.com/bitcoindevkit/bdk_wallet/issues/10>
924
+
let secp = Secp256k1::new();
925
+
926
+
// multipath tpub
927
+
let descriptor_str = "wpkh([9a6a2580/84'/1'/0']tpubDDnGNapGEY6AZAdQbfRJgMg9fvz8pUBrLwvyvUqEgcUfgzM6zc2eVK4vY9x9L5FJWdX8WumXuLEDV5zDZnTfbn87vLe9XceCFwTu9so9Kks/<0;1>/*)";
928
+
let(descriptor, _key_map) = descriptor_str
929
+
.into_wallet_descriptor(&secp,Network::Testnet)
930
+
.expect("should parse multipath tpub");
931
+
932
+
assert!(descriptor.is_multipath());
933
+
934
+
// invalid network for descriptor
935
+
let descriptor_str = "wpkh([9a6a2580/84'/0'/0']xpub6DEzNop46vmxR49zYWFnMwmEfawSNmAMf6dLH5YKDY463twtvw1XD7ihwJRLPRGZJz799VPFzXHpZu6WdhT29WnaeuChS6aZHZPFmqczR5K/<0;1>/*)";
936
+
let res = descriptor_str.into_wallet_descriptor(&secp,Network::Testnet);
let descriptor_str = "wpkh([9a6a2580/84'/0'/0']xpub6DEzNop46vmxR49zYWFnMwmEfawSNmAMf6dLH5YKDY463twtvw1XD7ihwJRLPRGZJz799VPFzXHpZu6WdhT29WnaeuChS6aZHZPFmqczR5K/<0;1>/*)";
945
+
let(descriptor, _key_map) = descriptor_str
946
+
.into_wallet_descriptor(&secp,Network::Bitcoin)
947
+
.expect("should parse multipath xpub");
948
+
949
+
assert!(descriptor.is_multipath());
950
+
951
+
// Miniscript can't make an extended private key with multiple paths into a public key.
0 commit comments