-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add descriptor templates #260
Add descriptor templates #260
Conversation
API design looks good to me. |
This PR is surprisingly more complex to pull off than one might think at first glance. The core issue is that descriptors in BDK are built on fairly complex types and generics coming from rust-miniscript and rust-bitcoin. Here are some notes I wrote for myself to keep track of the task at hand and the tradeoffs: Types related to extended keys and descriptors in bdk, rust-bitcoin, and miniscript:// bdk::keys::SinglePriv (miniscript) <- Struct
// bdk::keys::SinglePub (miniscript) <- Struct
// bdk::keys::DescriptorSecretKey (miniscript) <- Enum
// bdk::keys::DescriptorPublicKey (miniscript) <- Enum
// bdk::descriptor::DescriptorXKey (miniscript) <- Struct
// bdk::descriptor::Descriptor (miniscript) <- Enum
// bdk::keys::ExtendedKey (bdk) <- Enum
// bdk::keys::DerivableKey (bdk) <- Trait
// bdk::descriptor::IntoWalletDescriptor (bdk) <- Trait
// bdk::keys::DescriptorKey (bdk) <- Enum
// bdk::descriptor::ExtendedDescriptor (bdk) <- Alias for Descriptor<DescriptorPublicKey>
// bdk::descriptor::template::DescriptorTemplateOut <- Alias for (ExtendedDescriptor, KeyMap, ValidNetworks)
// bitcoin::util::bip32::ExtendedPrivKey (bitcoin) <- Struct
// bitcoin::util::bip32::ExtendedPubKey (bitcoin) <- Struct Bindings
|
378f4bd
to
0850905
Compare
Good progress was made today. BIP44, 49, and 84 "private" templates work. A few outstanding discussion items:
|
a7b4f13
to
8883c2c
Compare
6b53d4b
to
e9dc002
Compare
b48942b
to
6c74b8a
Compare
b7d1635
to
17c58ff
Compare
If bitcoindevkit/bdk/pull/821 gets merged I assume we might be ok with adding the dev-dependency on assert_matches as well. It feels much cleaner to me, and I have prepared an extra commit that brings that in. // asserting on the string
assert_eq!(wallet2.unwrap_err().to_string(), "Descriptor(Key(InvalidNetwork))");
// assert_matches!
assert_matches!(wallet2.unwrap_err(), bdk::Error::Descriptor(Key(InvalidNetwork))) |
d99e5d2
to
9c58ac4
Compare
0ef23f6
to
9b690f8
Compare
9b690f8
to
bada9b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK bada9b8
Fixes #165.
Also relevant is bitcoindevkit/bdk#817
Description
This PR adds the descriptor templates as described in #165.
Links
Docs for BIP84 template
Changelog notice
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features: