Commit 740c8c9
committed
Merge #306: Add docs + test on required use of xpub for multipath constructor
e647ed2 docs: add wording on required use of xpub for multipath constructor (thunderbiscuit)
Pull request description:
This PR makes explicit a limitation of the `Wallet::create_from_two_path_descriptor` method, in that you must use public descriptors to build the wallet using this constructor, meaning you can only build watch-only wallets.
I also added a test to showcase this and the error returned.
See [my comment here](#275 (comment)) for more:
From what I can tell the issue is that miniscript cannot parse an xprv (I saw a comment from Sanket about this somewhere but now I can't find it anymore) if the multipath contains hardened derivation paths, and therefore miniscipt cannot ensure the xprv will be parsable into public keys in all cases? Something like that. But our arguments for bdk wallet constructors require the `IntoWalletDescriptor` trait:
```rust
pub trait IntoWalletDescriptor {
/// Convert to wallet descriptor
fn into_wallet_descriptor(
self,
secp: &SecpCtx,
network: Network,
) -> Result<(ExtendedDescriptor, KeyMap), DescriptorError>;
}
pub type ExtendedDescriptor = Descriptor<DescriptorPublicKey>;
```
In other words, upon creation, the wallet will always try to parse the descriptor string into its public form, and here since it cannot be done by miniscript we fail to build.
### Changelog notice
No changelog notice.
### 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 `just p` before pushing
ACKs for top commit:
ValuedMammal:
ACK e647ed2
oleonardolima:
utACK e647ed2
Tree-SHA512: 15085dedc07c69f9e04876c174c4a8d54d186f0b04c6d1bf8ea76829cccdbf3f3644b7169392be5d03f0b983e4db6fd01afda6fb97ae348438f585cdde3fc08b1 file changed
+17
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
| 402 | + | |
| 403 | + | |
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
410 | | - | |
| 411 | + | |
| 412 | + | |
411 | 413 | | |
412 | 414 | | |
413 | 415 | | |
| |||
1224 | 1226 | | |
1225 | 1227 | | |
1226 | 1228 | | |
1227 | | - | |
| 1229 | + | |
1228 | 1230 | | |
1229 | 1231 | | |
1230 | 1232 | | |
| |||
2794 | 2796 | | |
2795 | 2797 | | |
2796 | 2798 | | |
| 2799 | + | |
2797 | 2800 | | |
2798 | 2801 | | |
2799 | 2802 | | |
| |||
2894 | 2897 | | |
2895 | 2898 | | |
2896 | 2899 | | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
2897 | 2911 | | |
2898 | 2912 | | |
2899 | 2913 | | |
| |||
0 commit comments