Currently, the IntoWalletDescriptor trait is exclusively defined for ExtendedDescriptors, which handle descriptors containing wildcards.
DerivedDescriptor, representing descriptors without wildcards, is currently excluded from the IntoWalletDescriptor trait. This enhancement proposes extending the trait to include DerivedDescriptor as well:
This enhancement will enable downstream users to create DerivedDescriptor instances for a keychain, leveraging all checks and validations performed by IntoWalletDescriptor and into_wallet_descriptor_checked.
Use case
Allow downstream users to seamlessly create DerivedDescriptor for their keychains.
Provide users with the benefit of using the comprehensive validation and conversion capabilities of the IntoWalletDescriptor trait and its associated functions.
Eliminate the need for users to manually perform validation and conversion tasks when dealing with DerivedDescriptor.
Additional context
The current implementation of IntoWalletDescriptor lacks support for DerivedDescriptor, limiting users in creating fully validated descriptors for their keychains.
The validation checks performed in into_wallet_descriptor and into_wallet_descriptor_checked are applicable to DerivedDescriptor as well, with exceptions for specific checks like hardened derivation steps or wildcards.
Testing has shown that extending IntoWalletDescriptor to include DerivedDescriptor does not break existing code, as shown:
#[test]
fn test() {
let secp = Secp256k1::new();
let desc_string = "wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcLNfjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2)#spaum87w";
let (descriptor, keymap) = desc_string
.into_wallet_descriptor(&secp, Network::Testnet)
.expect("failed to parse & validate descriptor");
println!("descriptor: {:?}\n", descriptor);
println!("keymap: {:?}", keymap);
}
Internal BDK structures, such as those in functions like reveal_next_spk, are already designed to handle descriptors with and without wildcards accordingly.
Several mentions in the BDK codebase already account for DerivedDescriptors, indicating that this enhancement aligns with the existing structure and design of the library.
Describe the enhancement
Types implementing the
IntoWalletDescriptor
trait can currently be converted intoExtendedDescriptor
and provide their correspondingKeyMap
:IntoWalletDescriptor
ExtendedDescriptor
Currently, the
IntoWalletDescriptor
trait is exclusively defined forExtendedDescriptors
, which handle descriptors containing wildcards.DerivedDescriptor
, representing descriptors without wildcards, is currently excluded from theIntoWalletDescriptor
trait. This enhancement proposes extending the trait to includeDerivedDescriptor
as well:DerivedDescriptor
This enhancement will enable downstream users to create
DerivedDescriptor
instances for a keychain, leveraging all checks and validations performed byIntoWalletDescriptor
andinto_wallet_descriptor_checked
.Use case
DerivedDescriptor
for their keychains.IntoWalletDescriptor
trait and its associated functions.DerivedDescriptor
.Additional context
The current implementation of
IntoWalletDescriptor
lacks support forDerivedDescriptor
, limiting users in creating fully validated descriptors for their keychains.The validation checks performed in
into_wallet_descriptor
andinto_wallet_descriptor_checked
are applicable toDerivedDescriptor
as well, with exceptions for specific checks like hardened derivation steps or wildcards.Testing has shown that extending
IntoWalletDescriptor
to includeDerivedDescriptor
does not break existing code, as shown:Internal BDK structures, such as those in functions like
reveal_next_spk
, are already designed to handle descriptors with and without wildcards accordingly.reveal_next_spk
Several mentions in the BDK codebase already account for DerivedDescriptors, indicating that this enhancement aligns with the existing structure and design of the library.