The public_descriptor function returns a reference to an ExtendedDescriptor, similar to get_descriptor on KeychainTxOutIndex, which returns an Option<Descriptor<DescriptorPublicKey>>
public_descriptor: Returns the public version of the descriptor.
get_descriptor_for_keychain: Returns the descriptor used to create addresses for a specific keychain
Therefore, we can eliminate get_descriptor_for_keychain and include its documentation in public_descriptor.
This change will reduce redundancy in Wallet API's.
Describe the enhancement
public_descriptor
function returns a reference to anExtendedDescriptor
, similar toget_descriptor
onKeychainTxOutIndex
, which returns anOption<Descriptor<DescriptorPublicKey>>
https://github.com/bitcoindevkit/bdk/blob/a112b4d97c02c3acb9728c55c6c150560b5cc0b7/crates/wallet/src/wallet/mod.rs#L1770
https://github.com/bitcoindevkit/bdk/blob/a112b4d97c02c3acb9728c55c6c150560b5cc0b7/crates/chain/src/keychain/txout_index.rs#L407
Currently,
public_descriptor
finds the descriptor from scratch. Instead, it can directly callget_descriptor
to simplify its implementation.get_descriptor_for_keychain
function is essentially a wrapper aroundpublic_descriptor
:https://github.com/bitcoindevkit/bdk/blob/a112b4d97c02c3acb9728c55c6c150560b5cc0b7/crates/wallet/src/wallet/mod.rs#L1882.
Both functions logically serve the same purpose:
public_descriptor
: Returns the public version of the descriptor.get_descriptor_for_keychain
: Returns the descriptor used to create addresses for a specific keychainTherefore, we can eliminate
get_descriptor_for_keychain
and include its documentation inpublic_descriptor
. This change will reduce redundancy in Wallet API's.Use case