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
fix(wallet): 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.
// 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